From fa9658cbfaa94fd5d0425041404e498c01db1aa3 Mon Sep 17 00:00:00 2001 From: baude Date: Tue, 6 Feb 2018 09:07:51 -0600 Subject: podman logs: fix tailing Fix issues with tailing of container logs as described in issue #16. Also add in the ability to use a duration or known time stamp formats for the --since flag. Signed-off-by: baude Closes: #317 Approved by: mheon --- docs/podman-logs.1.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'docs/podman-logs.1.md') diff --git a/docs/podman-logs.1.md b/docs/podman-logs.1.md index 414b98b8c..98dc7b180 100644 --- a/docs/podman-logs.1.md +++ b/docs/podman-logs.1.md @@ -9,7 +9,9 @@ podman logs - Fetch the logs of a container **podman** **logs** [*options* [...]] container ## DESCRIPTION -The podman logs command batch-retrieves whatever logs are present for a container at the time of execution. This does not guarantee execution order when combined with podman run (i.e. your run may not have generated any logs at the time you execute podman logs +The podman logs command batch-retrieves whatever logs are present for a container at the time of execution. +This does not guarantee execution order when combined with podman run (i.e. your run may not have generated +any logs at the time you execute podman logs ## OPTIONS @@ -19,14 +21,24 @@ Follow log output. Default is false **--since=TIMESTAMP** -Show logs since TIMESTAMP +Show logs since TIMESTAMP. The --since option can be Unix timestamps, date formatted timestamps, or Go duration +strings (e.g. 10m, 1h30m) computed relative to the client machine's time. Supported formats for date formatted +time stamps include RFC3339Nano, RFC3339, 2006-01-02T15:04:05, 2006-01-02T15:04:05.999999999, 2006-01-02Z07:00, +and 2006-01-02. **--tail=LINES** -Output the specified number of LINES at the end of the logs. LINES must be a positive integer. Defaults to 0, which prints all lines +Output the specified number of LINES at the end of the logs. LINES must be a positive integer. Defaults to 0, +which prints all lines + +**--timestamps, -t** + +Show timestamps in the log outputs. The default is false ## EXAMPLE +To view a container's logs: +``` podman logs b3f2436bdb978c1d33b1387afb5d7ba7e3243ed2ce908db431ac0069da86cb45 2017/08/07 10:16:21 Seeked /var/log/crio/pods/eb296bd56fab164d4d3cc46e5776b54414af3bf543d138746b25832c816b933b/c49f49788da14f776b7aa93fb97a2a71f9912f4e5a3e30397fca7dfe0ee0367b.log - &{Offset:0 Whence:0} @@ -39,13 +51,18 @@ podman logs b3f2436bdb978c1d33b1387afb5d7ba7e3243ed2ce908db431ac0069da86cb45 1:M 07 Aug 14:10:09.056 * Running mode=standalone, port=6379. 1:M 07 Aug 14:10:09.056 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:M 07 Aug 14:10:09.056 # Server initialized +``` - +To view only the last two lines in container's log: +``` podman logs --tail 2 b3f2436bdb97 1:M 07 Aug 14:10:09.056 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:M 07 Aug 14:10:09.056 # Server initialized +``` +To view a containers logs since a certain time: +``` podman logs 224c375f27cd --since 2017-08-07T10:10:09.055837383-04:00 myserver 1:M 07 Aug 14:10:09.055 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. @@ -53,9 +70,19 @@ podman logs 224c375f27cd --since 2017-08-07T10:10:09.055837383-04:00 myserver 1:M 07 Aug 14:10:09.056 * Running mode=standalone, port=6379. 1:M 07 Aug 14:10:09.056 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:M 07 Aug 14:10:09.056 # Server initialized +``` + +To view a container's logs generated in the last 10 minutes: +``` +podman logs 224c375f27cd --since 10m myserver + +1:M 07 Aug 14:10:09.055 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. +1:M 07 Aug 14:10:09.055 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'. +``` ## SEE ALSO podman(1) ## HISTORY August 2017, Originally compiled by Ryan Cole +February 2018, Updated by Brent Baude -- cgit v1.2.3-54-g00ecf