Viewing log files
Obtaining logs
To obtain logs from the containers:
docker cp <logstash container ID>:/var/lib/logstash/data logs/
where 'logs/
' is a local directory where the logs will be copied
into.
Viewing log files for a container
Use the docker-compose logs
command to view all logs:
docker-compose logs
For more information on Docker commands, visit the Docker documentation website: https://docs.docker.com/
Purging logs
Be default, log files are automatically purged after 14 days. To modify this value:
-
Stop the containers.
- Edit the
docker-compose.local-overrides.yml
file located in thedocker-swarm
directory:Add the logstash service.
Add the DAYS_TO_KEEP_LOGS environment variable with the new value. This example purges log files after 10 days:
logstash: environment: {DAYS_TO_KEEP_LOGS: 10}
-
Restart the containers.