forked from docker-library/ghost
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
You are a senior DevOps engineer. Your task is to generate a complete set of configuration files and documentation for integrating Traefik logs with Axiom using Vector, all managed within a Docker Compose setup.
The goal is to have Traefik write its access logs in JSON format to a shared volume, and have a Vector service read those logs from the volume and forward them to a specified Axiom dataset.
Generate the following three artifacts:
- A
docker-compose.ymlfile. - A Vector configuration file named
vector.yaml. - A
README.mdfile explaining the setup.
Requirements for docker-compose.yml
- Define three services:
traefik,vector, and a sample service likewhoamithattraefikcan route to. - Define a named volume (e.g.,
traefik-logs) to be shared between thetraefikandvectorservices. - Traefik Service:
- Use the official
traefikimage. - Configure the command arguments to enable the access log.
- Set the access log format to
json. - Set the access log file path to a file inside the shared volume (e.g.,
/logs/access.log). - Mount the shared volume to
/logs. - Map ports
80:80and8080:8080.
- Use the official
- Vector Service:
- Use the official
timberio/vectorimage. - Mount the shared
traefik-logsvolume to a path inside the container (e.g.,/var/log/traefik) so it can read the log file. - Mount the local
vector.yamlconfiguration file into the container (e.g., to/etc/vector/vector.yaml). - Pass the Axiom Dataset and API Token as environment variables from an
.envfile. UseAXIOM_DATASETandAXIOM_TOKENas the variable names.
- Use the official
- Whoami Service:
- Use the
traefik/whoamiimage. - Add labels for Traefik to discover and route traffic to this service.
- Use the
Requirements for vector.yaml
- Source:
- Define a
filesource namedtraefik_logs. - Set the
includepath to the location of the access log file inside the Vector container (e.g.,/var/log/traefik/access.log).
- Define a
- Sink:
- Define an
axiomsink namedaxiom_sink. - Set the input to come from the
traefik_logssource. - Set the
datasetandtokenfields to read from the environment variables${AXIOM_DATASET}and${AXIOM_TOKEN}respectively. - Enable
gzipcompression.
- Define an
Requirements for README.md
- Provide a clear title: "Traefik to Axiom Logging with Vector".
- Include a brief overview of the architecture (Traefik -> Shared Volume -> Vector -> Axiom).
- Prerequisites:
- List required tools: Docker and Docker Compose.
- List required credentials: An Axiom Dataset name and an Axiom API Ingest Token.
- Setup Instructions:
- Explain that the user must create an
.envfile in the same directory. - Provide a template for the
.envfile withAXIOM_DATASETandAXIOM_TOKENplaceholders. - Provide the command to start the services:
docker-compose up -d.
- Explain that the user must create an
- Verification:
- Explain how to generate traffic (e.g., by visiting
http://localhost). - Instruct the user to check their Axiom dataset for incoming logs.
- Explain how to generate traffic (e.g., by visiting
- File Structure:
- Show a simple tree diagram of the required files:
. βββ docker-compose.yml βββ vector.yaml βββ .env
- Show a simple tree diagram of the required files:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels