Guide

Find your API consumers from Traefik access logs

Last checked 2026-12-019 min read

Traefik can log who made each request once its access log keeps the header that names the client. A JSON access log writes it with the method, host and path, the graphwake usage step turns the log into a summary on a machine that can read it, and each team confirms its clients once in Graphwake. From then on a breaking change reaches the teams that really call the endpoint. Usage Discovery is on Pro and Enterprise.

ExampleService graph · orders-api
GET/orders/{id}2 consumer teams
Service
orders-api
Owner
payments-team

Consumers

  • checkout · 4 peopleSlack #team-checkout
  • mobile-app · 6 peopleSlack #mobile-alerts

Suggested by Discovery

  • storefront · uses a neighbouring endpointmaybe · 72
GET/orders/{id}/invoiceBlind spot

No team subscribes to this endpoint. A breaking change here reaches no subscribed team.

Who owns an endpoint, who consumes it, and where nobody is listening. A suggested team is added only when someone confirms it.

Graphwake is for you if

  • Your APIs sit behind Traefik, and each client names itself in a request header.
  • Nobody keeps an accurate list of which team calls which endpoint.
  • You want each team to confirm its clients once instead of keeping a list.

Already using Traefik? Keep it. Graphwake works next to it.

On this page
  1. What you get
  2. Before you start
  3. Step 1: add a usage source
  4. Step 2: export the calls
  5. Step 3: read what would be sent
  6. Step 4: send it on a schedule
  7. Step 5: claim your callers
  8. What is sent
  9. Good to know
  10. Questions

What you get

Graphwake learns which clients call which of your endpoints behind Traefik, and how often. When a team confirms a client, every endpoint that client uses becomes a subscription of that team.

Optional. Without it, Graphwake still needs only your spec.

Before you start

  • Clients that name themselves in an X-Client-Id request header, and Traefik's access log written as JSON to a file, with that header kept.
  • A Graphwake workspace on Pro or Enterprise, and an Admin to add the usage source.
  • The Graphwake agent, which is open source: a binary from its releases on the machine where you try the steps below, or Docker to run its image ghcr.io/graphwake/agent:0.5.0.
  • A machine that can read Traefik's access log file and can run Docker, such as a self-hosted runner or agent on the Traefik host.

Step 1: add a usage source

  1. In Graphwake, open Settings → Integrations → Usage sources and choose Add a source.
  2. Copy the usage key. It is shown once. Store it as a secret named GRAPHWAKE_USAGE_KEY in the pipeline that will run the step.

Step 2: export the calls

graphwake usage query --source traefik prints the static configuration that writes the access log as JSON to a file and keeps the X-Client-Id request header, and the same settings as command-line flags:

yaml
# Traefik: write the access log as JSON and keep the header that names the caller (static
# configuration, traefik.yml), then send the file. One JSON object per line.
accessLog:
  filePath: /var/log/traefik/access.log
  format: json
  fields:
    headers:
      names:
        X-Client-Id: keep
# The same as command-line flags:
#   --accesslog=true --accesslog.filepath=/var/log/traefik/access.log
#   --accesslog.format=json --accesslog.fields.headers.names.X-Client-Id=keep
# The caller is the kept X-Client-Id request header (written as request_X-Client-Id); a
# request without it has no caller name. The basic auth user (ClientUsername; also the
# forward auth user when its headerField is set) may be a person, so it is read only with
# --caller-field ClientUsername. The client address (ClientHost) is never sent: for a
# request without the header it can find a name in a --caller-map file of CIDR rows; a
# request the header names is never renamed by such a row. The query string of
# RequestPath is dropped before matching.
# Send the file, for example:
#   graphwake usage --source traefik --input /var/log/traefik/access.log
# Lines that are not access log lines are skipped and counted.
What graphwake usage query --source traefik prints.

Traefik writes the kept header as request_X-Client-Id, and that value is the caller. The step reads the method, the host, the path, the time and the caller of each line; the client address, ClientHost, is read only for a caller map. Write the access log to a file of its own. Traefik reads its static configuration when it starts. There is no separate export: the file is the export.

Step 3: read what would be sent

Run the step with --dry-run. It uses the usage key to ask Graphwake for your endpoint list, prints the summary it would send and what is not sent, and sends no summary. In CI its output is the job log.

bash
export GRAPHWAKE_USAGE_KEY=<your usage key>
graphwake usage --source traefik --input /var/log/traefik/access.log --dry-run

With the Docker image instead, give it the file on standard input: docker run --rm -i -e GRAPHWAKE_USAGE_KEY ghcr.io/graphwake/agent:0.5.0 usage --source traefik --dry-run < /var/log/traefik/access.log.

text
--- would send ---
{"preset":"apim","agentVersion":"0.5.0","windowStart":"2026-11-12","windowEnd":"2026-11-18",
 "countsIncluded":true,"unmatchedRequests":412,"withheldRequests":3,"anonymousRequests":7,
 "rows":[{"caller":"checkout-web","callerKind":"client","endpointId":"9d2c...",
          "service":"orders-api","method":"GET","path":"/orders/{}","count":14200,"lastSeen":"2026-11-18"}]}
--- end ---
Not sent to Graphwake:
  Requests that matched no endpoint, by host and path prefix:
    - gateway.internal /internal/health  412
  Requests withheld because the caller name looked personal: 3
  Requests without a caller name: 7
Example output from an Azure API Management export, with the JSON broken over lines. Yours names your preset and lists your own callers and endpoints.

Requests that matched none of your endpoints are listed by host and path prefix, at most 20 rows: the prefix is the first two segments of the path, and a segment that contains a digit, @ or %, or is longer than 24 characters, is printed as *. In a real run only their number is sent. If they are calls to your services through a gateway, add a mapping rule on the usage source and run the dry run again.

For requests without the header, a caller map can name the range that holds the client address: a CSV file of CIDR rows you keep next to the pipeline. A CIDR row never renames a request the header names. Each row is match,name: match is an exact value, compared letter case included, or an address range such as 10.2.0.0/16, and name is the caller name sent instead. A mapped name still goes through the withholding rules. The caller map file, and the raw values it maps, are never sent.

text
match,name
10.2.0.0/16,billing-batch
callers.csv: an example caller map. The header line is optional.
bash
graphwake usage --source traefik --input /var/log/traefik/access.log --caller-map callers.csv --dry-run

With a caller map the dry run also prints how many requests the map named and how many were left unnamed. A row that cannot be used, such as an invalid range, an empty name or a match an earlier row has, stops the run before the input is read: nothing is sent, and the warning names the row number only.

Step 4: send it on a schedule

The step reads the file Traefik wrote, so the job must run where that file is: on a self-hosted runner or agent on the Traefik host, or on one that has the log directory mounted. It needs Docker and read access to the file. In Azure Pipelines, replace <your agent pool> with the pool that holds that agent.

yaml
name: Graphwake usage
on:
  schedule:
    - cron: "0 5 * * *"

jobs:
  usage:
    runs-on: [self-hosted, linux]
    steps:
      - name: Send the usage summary
        env:
          GRAPHWAKE_USAGE_KEY: ${{ secrets.GRAPHWAKE_USAGE_KEY }}
        run: docker run --rm -i -e GRAPHWAKE_USAGE_KEY ghcr.io/graphwake/agent:0.5.0 usage --source traefik < /var/log/traefik/access.log
GitHub Actions: .github/workflows/graphwake-usage.yml.
yaml
schedules:
  - cron: '0 5 * * *'
    displayName: Daily usage summary
    branches:
      include: [main]
    always: true

trigger: none
pr: none

pool:
  name: <your agent pool>

steps:
  - checkout: none
  - bash: docker run --rm -i -e GRAPHWAKE_USAGE_KEY ghcr.io/graphwake/agent:0.5.0 usage --source traefik < /var/log/traefik/access.log
    displayName: Send the usage summary
    env:
      GRAPHWAKE_USAGE_KEY: $(GRAPHWAKE_USAGE_KEY)
Azure Pipelines: a pipeline of its own, with GRAPHWAKE_USAGE_KEY as a secret variable.

Both examples run the agent's Docker image ghcr.io/graphwake/agent:0.5.0 once a day at 05:00 UTC, with the usage key from a secret. The export goes into the container on standard input, which is why docker run has -i.

Each run summarizes the whole file it reads, so rotate the log and point the step at the file that covers the period you want, for example yesterday's rotated file, by changing the path in the examples. Each summary's counts replace the previous one's for the same caller and endpoint, so reading the same lines twice does not add them up. Traefik does not rotate its access log itself: when it receives the USR1 signal, it closes the file and opens it again, so a tool such as logrotate can rename it first.

To use the caller map in the schedule, keep callers.csv in the repository that holds the pipeline, check the repository out in the job (in GitHub Actions add the actions/checkout step first; in Azure Pipelines replace checkout: none with checkout: self), and give the file to the container: docker run --rm -i -e GRAPHWAKE_USAGE_KEY -v "$PWD/callers.csv:/callers.csv:ro" ghcr.io/graphwake/agent:0.5.0 usage --source traefik --caller-map /callers.csv < /var/log/traefik/access.log.

The agent does not fail the pipeline: it prints one result line, so a summary that was not sent shows as a warning in the job log, not as a red job (a missing file or image still fails the step, and so does the runner stopping the agent before it finishes, for example when it runs out of memory).

Step 5: claim your callers

After the first summary arrives, open Discovery → Callers in Graphwake.

  • When Graphwake can suggest a team for a caller, for example because the names match, Confirm adds the caller to that team and Not us dismisses the suggestion.
  • Any caller can be claimed with Claim for my team: a team member claims it for their own team, an Admin for any team.
  • Every endpoint a claimed caller uses becomes a subscription of that team, and new endpoints follow with later summaries. The next breaking change on them reaches the team in its own channel.
  • A subscription the team removes is not added back, and a caller that stops calling keeps its subscriptions. An Admin can ignore a caller that is not a client, such as a health check.

What is sent

  • The caller's name. The X-Client-Id request header, which Traefik writes as request_X-Client-Id, so that header's value is sent as the caller name. For a request without it, the name your caller map gives the range that holds its client address; the address itself is never sent. To read the basic auth user instead, name it with --caller-field ClientUsername; it may be a person, so it is never read by default. Point the field at a value that names the client and nothing else: whatever it holds is what is sent as the caller name, unless it is withheld.
  • The endpoint, as a path template such as /orders/{}, never the concrete path.
  • How many calls, and the last day the caller was seen.

Other than the one value you choose as the caller name, nothing from a request leaves your network: no body, header, query string or IP address. What the usage step sends lists every field.

Note

Good to know

  • A request without the X-Client-Id header has no caller name, unless a CIDR row of your caller map holds its client address.
  • The basic auth user (ClientUsername) may be a person, so it is read only when you name it with --caller-field ClientUsername.
  • Write the access log to its own file: lines in another format, such as Traefik's own log, are skipped and counted.
See who your next breaking change reaches.Paste a spec URL or add one CI step. 14-day free trial, then a free plan. No credit card needed.
Start free trial

Questions

Does Graphwake need access to our Traefik servers?

No. The step runs on a machine that can read the log, with your own access to it. Graphwake holds no credential for your servers; it receives only the summary.

Is the client IP address sent?

No. ClientHost is only compared with your caller map's ranges, for requests without the header. The caller map file, and the raw values it maps, are never sent.

Is Usage Discovery required?

No. It is optional, on Pro and Enterprise. Without it, Graphwake still needs only your spec, and teams subscribe to the endpoints they call.

Pick an endpoint. See who it reaches. 14-day free trial, then a free plan. No credit card needed.

Start free trial

Sources and last verified

Sources checked on 2026-12-01.