apps:docker:troubleshooting
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
apps:docker:troubleshooting [2025-02-01 20:10] – add info to disk usage Manuel Frei | apps:docker:troubleshooting [2025-02-04 17:09] (current) – add xargs data Manuel Frei | ||
---|---|---|---|
Line 54: | Line 54: | ||
container_pid=" | container_pid=" | ||
nsenter -n -t " | nsenter -n -t " | ||
+ | </ | ||
+ | |||
+ | ===== Logs ===== | ||
+ | |||
+ | ==== Add Local Timestamp to Container Logs ==== | ||
+ | |||
+ | If a container is logging without a timestamp or with an unknown time zone, you can add a timestamp while watching the logs. | ||
+ | <code bash> | ||
+ | docker logs mycontainer -n 0 -f | xargs -IL date +' | ||
+ | </ | ||
+ | |||
+ | In case you want to catch the stderr logs, too | ||
+ | <code bash> | ||
+ | docker logs mycontainer -n 0 -f 2>&1 | xargs -IL date +' | ||
+ | </ | ||
+ | |||
+ | <code - Example> | ||
+ | root@server: | ||
+ | [2025-02-04T16: | ||
+ | [2025-02-04T16: | ||
+ | [2025-02-04T16: | ||
+ | [2025-02-04T16: | ||
+ | [2025-02-04T16: | ||
+ | [2025-02-04T16: | ||
</ | </ | ||
apps/docker/troubleshooting.txt · Last modified: 2025-02-04 17:09 by Manuel Frei