mirror of
https://github.com/containers/podman.git
synced 2025-05-20 16:47:39 +08:00
110 lines
5.1 KiB
Markdown
110 lines
5.1 KiB
Markdown
% podman-logs 1
|
|
|
|
## NAME
|
|
podman\-logs - Display the logs of one or more containers
|
|
|
|
## SYNOPSIS
|
|
**podman logs** [*options*] *container* [*container...*]
|
|
|
|
**podman container logs** [*options*] *container* [*container...*]
|
|
|
|
## DESCRIPTION
|
|
The podman logs command batch-retrieves whatever logs are present for one or more containers 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
|
|
|
|
@@option color
|
|
|
|
@@option follow
|
|
|
|
#### **--latest**, **-l**
|
|
|
|
Instead of providing the container name or ID, use the last created container. If you use methods other than Podman
|
|
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)
|
|
|
|
@@option names
|
|
|
|
@@option since
|
|
|
|
@@option tail
|
|
|
|
@@option timestamps
|
|
|
|
@@option until
|
|
|
|
## EXAMPLE
|
|
|
|
To view a container's logs:
|
|
```
|
|
podman logs -t b3f2436bdb978c1d33b1387afb5d7ba7e3243ed2ce908db431ac0069da86cb45
|
|
|
|
2017/08/07 10:16:21 Seeked /var/log/crio/pods/eb296bd56fab164d4d3cc46e5776b54414af3bf543d138746b25832c816b933b/c49f49788da14f776b7aa93fb97a2a71f9912f4e5a3e30397fca7dfe0ee0367b.log - &{Offset:0 Whence:0}
|
|
1:C 07 Aug 14:10:09.055 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
|
|
1:C 07 Aug 14:10:09.055 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=1, just started
|
|
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
|
|
1:M 07 Aug 14:10:09.055 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
|
|
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'.
|
|
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
|
|
|
|
# WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
|
|
# Server initialized
|
|
```
|
|
|
|
To view all containers logs:
|
|
```
|
|
podman logs -t --since 0 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'.
|
|
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 containers logs since a certain time:
|
|
```
|
|
podman logs -t --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.
|
|
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'.
|
|
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 --since 10m myserver
|
|
|
|
# Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
|
|
# 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'.
|
|
```
|
|
|
|
To view a container's logs until 30 minutes ago:
|
|
```
|
|
podman logs --until 30m myserver
|
|
|
|
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
|
|
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
|
|
[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
|
|
[Tue Jul 20 13:18:14.223819 2021] [core:notice] [pid 1:tid 140021067187328] AH00094: Command line: 'httpd -D FOREGROUND'
|
|
```
|
|
|
|
## SEE ALSO
|
|
**[podman(1)](podman.1.md)**, **[podman-run(1)](podman-run.1.md)**, **[podman-container-rm(1)](podman-container-rm.1.md)**
|
|
|
|
## HISTORY
|
|
February 2018, Updated by Brent Baude <bbaude@redhat.com>
|
|
|
|
August 2017, Originally compiled by Ryan Cole <rycole@redhat.com>
|