github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/docs/source/markdown/podman-logs.1.md (about) 1 % podman-logs(1) 2 3 ## NAME 4 podman\-logs - Display the logs of one or more containers 5 6 ## SYNOPSIS 7 **podman logs** [*options*] *container* [*container...*] 8 9 **podman container logs** [*options*] *container* [*container...*] 10 11 ## DESCRIPTION 12 The podman logs command batch-retrieves whatever logs are present for one or more containers at the time of execution. 13 This does not guarantee execution order when combined with podman run (i.e. your run may not have generated 14 any logs at the time you execute podman logs). 15 16 ## OPTIONS 17 18 #### **--follow**, **-f** 19 20 Follow log output. Default is false. 21 22 Note: If you are following a container which is removed `podman container rm` 23 or removed on exit `podman run --rm ...`, then there is a chance the the log 24 file will be removed before `podman logs` reads the final content. 25 26 #### **--latest**, **-l** 27 28 Instead of providing the container name or ID, use the last created container. If you use methods other than Podman 29 to run containers such as CRI-O, the last started container could be from either of those methods. 30 31 The latest option is not supported on the remote client. 32 33 #### **--names**, **-n** 34 35 Output the container name in the log 36 37 #### **--since**=*TIMESTAMP* 38 39 Show logs since TIMESTAMP. The --since option can be Unix timestamps, date formatted timestamps, or Go duration 40 strings (e.g. 10m, 1h30m) computed relative to the client machine's time. Supported formats for date formatted 41 time stamps include RFC3339Nano, RFC3339, 2006-01-02T15:04:05, 2006-01-02T15:04:05.999999999, 2006-01-02Z07:00, 42 and 2006-01-02. 43 44 #### **--tail**=*LINES* 45 46 Output the specified number of LINES at the end of the logs. LINES must be an integer. Defaults to -1, 47 which prints all lines 48 49 #### **--timestamps**, **-t** 50 51 Show timestamps in the log outputs. The default is false 52 53 ## EXAMPLE 54 55 To view a container's logs: 56 ``` 57 podman logs -t b3f2436bdb978c1d33b1387afb5d7ba7e3243ed2ce908db431ac0069da86cb45 58 59 2017/08/07 10:16:21 Seeked /var/log/crio/pods/eb296bd56fab164d4d3cc46e5776b54414af3bf543d138746b25832c816b933b/c49f49788da14f776b7aa93fb97a2a71f9912f4e5a3e30397fca7dfe0ee0367b.log - &{Offset:0 Whence:0} 60 1:C 07 Aug 14:10:09.055 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 61 1:C 07 Aug 14:10:09.055 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=1, just started 62 1:C 07 Aug 14:10:09.055 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 63 1:M 07 Aug 14:10:09.055 # You requested maxclients of 10000 requiring at least 10032 max file descriptors. 64 1:M 07 Aug 14:10:09.055 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. 65 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'. 66 1:M 07 Aug 14:10:09.056 * Running mode=standalone, port=6379. 67 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. 68 1:M 07 Aug 14:10:09.056 # Server initialized 69 ``` 70 71 To view only the last two lines in container's log: 72 ``` 73 podman logs --tail 2 b3f2436bdb97 74 75 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 76 # Server initialized 77 ``` 78 79 To view a containers logs since a certain time: 80 ``` 81 podman logs -t --since 2017-08-07T10:10:09.055837383-04:00 myserver 82 83 1:M 07 Aug 14:10:09.055 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. 84 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'. 85 1:M 07 Aug 14:10:09.056 * Running mode=standalone, port=6379. 86 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. 87 1:M 07 Aug 14:10:09.056 # Server initialized 88 ``` 89 90 To view a container's logs generated in the last 10 minutes: 91 ``` 92 podman logs --since 10m myserver 93 94 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. 95 # 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'. 96 ``` 97 98 ## SEE ALSO 99 podman(1), podman-run(1), podman-container-rm(1) 100 101 ## HISTORY 102 February 2018, Updated by Brent Baude <bbaude@redhat.com> 103 104 August 2017, Originally compiled by Ryan Cole <rycole@redhat.com>