Aquire Manager Logs When Deployed Using Docker
This document describes how to aquire logs for the Fluent Manager application when deployed using Docker.
Step 1: Get ID of the Docker Container
The Manager contains 3 Docker containers for the different components. There is the frontend, backend, and database. To get the IDs of the current containers, run the following command:
docker ps
This will list all the running containers and their IDs. For example:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0af3385f7e3e public.ecr.aws/apryse/fluent-manager-frontend:24.2.0.32 "/opt/manager/startu…" 30 minutes ago Up 30 minutes 80/tcp, 0.0.0.0:80->8080/tcp, :::80->8080/tcp fluent-manager-frontend
481b92dbff4c public.ecr.aws/apryse/fluent-manager-backend:24.2.0.32 "java -jar template-…" 30 minutes ago Up 30 minutes 8000/tcp, 8080/tcp fluent-manager-backend
d95ec2ac337e public.ecr.aws/apryse/fluent-manager-db:24.2.0.32 "docker-entrypoint.s…" 30 minutes ago Up 30 minutes 5432/tcp fluent-manager-db
Step 2: Get Logs
To get the logs for the specific container, just run the following command
docker logs <container_id>
For example, using the above example container data, to get the logs for the backend container, run the following command:
docker logs 481b92dbff4c
This will output the logs for the backend container.
Example output:
2021-08-26 20:00:00.000 INFO 1 --- [ main] c.a.f.m.FluentManagerApplication : Starting FluentManagerApplication v1.0.0-SNAPSHOT using Java 11.0.11 on 481b92dbff4c with PID 1 (/opt/manager/template-manager.jar started by root in /opt/manager)
2021-08-26 20:00:00.000 INFO 1 --- [ main] c.a.f.m.FluentManagerApplication : No active profile set, falling back to default profiles: default
2021-08-26 20:00:00.000 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-08-26 20:00:00.000 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 1 ms. Found 0 JPA repository interfaces.
2021-08-26 20:00:00.000 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
...etc
Step 3: Save Logs to a File
We can take this a step further and save the logs to a file for easier viewing. We will use the redirection operator >
to save the logs to a file. For example, to save the logs for the backend container to a file named backend_logs.txt
, run the following command:
docker logs 481b92dbff4c > backend_logs.txt
This will save the logs to a file named backend_logs.txt
in the current directory. You can also specify a specific path to save the file to a different location.