Docs
/
Log Ingestion
/
Docker Containers
Docker Container Ingestion
Stream telemetry and security incident patterns from containerized microservices without modifying your application code.
1. Integration Patterns
To collect logs from Docker containers, there are two standard patterns:
- Sidecar Pattern (Recommended): Run the `sprint-log-shipper` in its own container alongside your application container. They share a Docker Volume where logs are written.
- Host-Level Mount: Run the shipper on the host node itself, mounting Docker's default container directory `/var/lib/docker/containers` to watch standard stdout/stderr logs.
2. Containerizing the Shipper
Create a `Dockerfile` for the shipper service to install dependencies (Python 3) and pull the agent:
FROM python:3.10-slim WORKDIR /app # Download the unified Python shipper agent ADD https://sprint-logparser.dev.5starcompany.com.ng/download/shipper /usr/local/bin/log_shipper.py RUN chmod +x /usr/local/bin/log_shipper.py # Create log file directory RUN mkdir -p /var/log/app && mkdir -p /etc/log-shipper CMD ["python", "/usr/local/bin/log_shipper.py", "/etc/log-shipper/config.json"]
3. Docker Compose Sidecar Deployment
Mount a shared named volume between your application (e.g. Nginx, Laravel) and the shipper sidecar container inside your `docker-compose.yml`:
version: '3.8'
services:
# Main application service (writing logs)
web:
image: nginx:latest
volumes:
- shared-logs:/var/log/nginx
# Log shipper sidecar
shipper:
build: .
volumes:
# Mount shared volume containing Nginx logs
- shared-logs:/var/log/app:ro
# Mount configuration file
- ./config.json:/etc/log-shipper/config.json:ro
restart: always
volumes:
shared-logs:
Configure the `./config.json` mounted file in the shipper container as follows:
{
"api_url": "https://sprint-logparser.dev.5starcompany.com.ng/api/projects/ingest",
"api_token": "YOUR_WORKSPACE_INGESTION_TOKEN",
"log_file": "/var/log/app/access.log",
"log_type": "nginx_access"
}