Files
coolify/tests/Feature/TrafficAnalytics/TraefikAccessLogTest.php
T
Aditya Tripathi a5cfa7c238 feat(traffic): add global analytics page with status time series
Replace the server-scoped Analytics Livewire component with an
app-wide one that filters by server/application and supports live
refresh. Add a per-bucket status-class time series endpoint/data
class for a stacked-area chart, falling back to the donut when the
Sentinel build doesn't support it. Decorate top-path rows with their
owning domain, expand breakdown dimensions to agent/ip/useragent, and
raise path/breakdown result limits. Capture X-Forwarded-For,
User-Agent, and Referer headers in traefik access logs (now enabled
in dev too) so IP, browser, and referrer breakdowns work. Add
flag-image and referer-host helpers for geo/referrer rendering.
2026-08-12 08:50:58 +00:00

21 lines
1.0 KiB
PHP

<?php
it('returns empty commands when traffic analytics is disabled', function () {
expect(traefikAccessLogCommands(false))->toBe([]);
});
it('returns JSON access log + Cloudflare header capture flags when enabled', function () {
$cmds = traefikAccessLogCommands(true);
expect($cmds)->toContain('--accesslog=true')
->toContain('--accesslog.filepath=/traefik/access.log')
->toContain('--accesslog.format=json')
->toContain('--accesslog.fields.headers.names.Cf-Connecting-Ip=keep')
->toContain('--accesslog.fields.headers.names.Cf-Ipcountry=keep')
->toContain('--accesslog.fields.headers.names.Cf-Cache-Status=keep')
->toContain('--accesslog.fields.headers.names.Cf-Verified-Bot=keep')
->toContain('--accesslog.fields.headers.names.Cf-Ray=keep')
->toContain('--accesslog.fields.headers.names.X-Forwarded-For=keep')
->toContain('--accesslog.fields.headers.names.User-Agent=keep')
->toContain('--accesslog.fields.headers.names.Referer=keep');
});