<!-- TITLE: Application Logs --> <!-- SUBTITLE: Application logs support in SWARM mode --> # Application Logs in SWARM Mode The task is to save application logs in container to host by mean JournalD Driver. ## Update Run Command Update run command for service and make symlink to /proc/1/fd/1 from all target log files to push logs to STDOUT. If possible this should be done in entrypoint file (https://wiki.devopss.ru/dockerfiles/entrypoint-sh) file instead. For such service as sidekiq we can set in args directly: ```sh export PROJECT=project sudo docker service update --args "bash -c 'ln -sf /proc/1/fd/1 /opt/app/log/staging.log && bundle exec sidekiq -C config/sidekiq.yml -e staging '" ${PROJECT}_sidekiq ``` ## Update service default log driver to JournalD ```sh sudo docker service update --log-driver=journald --log-opt tag=${PROJECT}_backend_logs ${PROJECT}_backend ``` ## Check for logs by tag ```sh sudo journalctl --since "1 hour ago" | grep ${PROJECT}_sidekiq_logs ```