Collecting Docker Container Logs

You can easily collect all your Docker container logs using OpenTelemetry Collector and perform advanced queries to analyze them efficiently using SigNoz.

Collect Docker Container Logs in SigNoz Cloud

  1. Clone the Repository

    git clone https://github.com/SigNoz/docker-container-logs
    

    This repository provides a pre-configured OpenTelemetry Collector setup with otel-collector-config.yaml and docker-compose.yaml, enabling easy log collection and forwarding to SigNoz Cloud with minimal changes and no manual configuration.

  2. Update Environment Variables

    Update the Environment variables in the .env file of docker-container-logs repository:

    OTEL_COLLECTOR_ENDPOINT=ingest.<region>.signoz.cloud:443
    SIGNOZ_INGESTION_KEY=<your-ingestion-key>
    
  3. Start Containers
    Run the following command inside the docker-container-logsto start the containers:

    docker compose up -d
    
  4. Verify Log Export
    If there are no errors, your logs will be exported and visible on the SigNoz UI.

Using Logspout-SigNoz for Enhanced Log Collection

To improve log organization and insight, especially for JSON logs containing serviceName and env fields, use the logspout-signoz extension. It labels logs with service names, severity levels, and environment details.

For detailed setup instructions, check the Rich Logs Collector for Docker Compose Services with SigNoz guide.

Was this page helpful?