github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/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 #### **--color** 19 20 Output the containers with different colors in the log. 21 22 #### **--follow**, **-f** 23 24 Follow log output. Default is false. 25 26 Note: If you are following a container which is removed `podman container rm` 27 or removed on exit `podman run --rm ...`, then there is a chance that the log 28 file will be removed before `podman logs` reads the final content. 29 30 #### **--latest**, **-l** 31 32 Instead of providing the container name or ID, use the last created container. If you use methods other than Podman 33 to run containers such as CRI-O, the last started container could be from either of those methods. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) 34 35 #### **--names**, **-n** 36 37 Output the container name in the log 38 39 #### **--since**=*TIMESTAMP* 40 41 Show logs since TIMESTAMP. The --since option can be Unix timestamps, date formatted timestamps, or Go duration 42 strings (e.g. 10m, 1h30m) computed relative to the client machine's time. Supported formats for date formatted 43 time stamps include RFC3339Nano, RFC3339, 2006-01-02T15:04:05, 2006-01-02T15:04:05.999999999, 2006-01-02Z07:00, 44 and 2006-01-02. 45 46 #### **--tail**=*LINES* 47 48 Output the specified number of LINES at the end of the logs. LINES must be an integer. Defaults to -1, 49 which prints all lines 50 51 #### **--timestamps**, **-t** 52 53 Show timestamps in the log outputs. The default is false 54 55 #### **--until**=*TIMESTAMP* 56 57 Show logs until TIMESTAMP. The --until option can be Unix timestamps, date formatted timestamps, or Go duration 58 strings (e.g. 10m, 1h30m) computed relative to the client machine's time. Supported formats for date formatted 59 time stamps include RFC3339Nano, RFC3339, 2006-01-02T15:04:05, 2006-01-02T15:04:05.999999999, 2006-01-02Z07:00, 60 and 2006-01-02. 61 62 ## EXAMPLE 63 64 To view a container's logs: 65 ``` 66 podman logs -t b3f2436bdb978c1d33b1387afb5d7ba7e3243ed2ce908db431ac0069da86cb45 67 68 2017/08/07 10:16:21 Seeked /var/log/crio/pods/eb296bd56fab164d4d3cc46e5776b54414af3bf543d138746b25832c816b933b/c49f49788da14f776b7aa93fb97a2a71f9912f4e5a3e30397fca7dfe0ee0367b.log - &{Offset:0 Whence:0} 69 1:C 07 Aug 14:10:09.055 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 70 1:C 07 Aug 14:10:09.055 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=1, just started 71 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 72 1:M 07 Aug 14:10:09.055 # You requested maxclients of 10000 requiring at least 10032 max file descriptors. 73 1:M 07 Aug 14:10:09.055 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. 74 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'. 75 1:M 07 Aug 14:10:09.056 * Running mode=standalone, port=6379. 76 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. 77 1:M 07 Aug 14:10:09.056 # Server initialized 78 ``` 79 80 To view only the last two lines in container's log: 81 ``` 82 podman logs --tail 2 b3f2436bdb97 83 84 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 85 # Server initialized 86 ``` 87 88 To view all containers logs: 89 ``` 90 podman logs -t --since 0 myserver 91 92 1:M 07 Aug 14:10:09.055 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. 93 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'. 94 1:M 07 Aug 14:10:09.056 * Running mode=standalone, port=6379. 95 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. 96 1:M 07 Aug 14:10:09.056 # Server initialized 97 ``` 98 99 To view a containers logs since a certain time: 100 ``` 101 podman logs -t --since 2017-08-07T10:10:09.055837383-04:00 myserver 102 103 1:M 07 Aug 14:10:09.055 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. 104 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'. 105 1:M 07 Aug 14:10:09.056 * Running mode=standalone, port=6379. 106 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. 107 1:M 07 Aug 14:10:09.056 # Server initialized 108 ``` 109 110 To view a container's logs generated in the last 10 minutes: 111 ``` 112 podman logs --since 10m myserver 113 114 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. 115 # 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'. 116 ``` 117 118 To view a container's logs until 30 minutes ago: 119 ``` 120 podman logs --until 30m myserver 121 122 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.0.2.100. Set the 'ServerName' directive globally to suppress this message 123 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.0.2.100. Set the 'ServerName' directive globally to suppress this message 124 [Tue Jul 20 13:18:14.223727 2021] [mpm_event:notice] [pid 1:tid 140021067187328] AH00489: Apache/2.4.48 (Unix) configured -- resuming normal operations 125 [Tue Jul 20 13:18:14.223819 2021] [core:notice] [pid 1:tid 140021067187328] AH00094: Command line: 'httpd -D FOREGROUND' 126 ``` 127 128 ## SEE ALSO 129 **[podman(1)](podman.1.md)**, **[podman-run(1)](podman-run.1.md)**, **[podman-container-rm(1)](podman-container-rm.1.md)** 130 131 ## HISTORY 132 February 2018, Updated by Brent Baude <bbaude@redhat.com> 133 134 August 2017, Originally compiled by Ryan Cole <rycole@redhat.com>