| podman-logs(1) | General Commands Manual | podman-logs(1) |
نام (NAME)
podman-logs - نمایش لاگهای یک یا چند کانتینر
خلاصه دستور (SYNOPSIS)
podman logs [گزینهها] کانتینر [کانتینر...]
podman container logs [گزینهها] کانتینر [کانتینر...]
توضیحات (DESCRIPTION)
دستور podman logs هر لاگی را که در زمان اجرا برای یک یا چند کانتینر وجود داشته باشد، بهصورت دستهای (batch) بازیابی میکند. این دستور هنگام ترکیب با podman run ترتیبی را برای اجرا تضمین نمیکند (یعنی ممکن است در زمان اجرای podman logs هنوز هیچ لاگی توسط کانتینر ایجاد نشده باشد).
گزینهها (OPTIONS)
--color
نمایش خروجی لاگ هر کانتینر با رنگی متفاوت.
--follow, -f
دنبال کردن خروجی لاگ بهصورت زنده (Follow). پیشفرض false است.
نکته: هنگام دنبال کردن لاگ کانتینری که با podman container rm حذف میشود یا در زمان خروج حذف میگردد (podman run --rm ...)، این احتمال وجود دارد که فایل لاگ قبل از اینکه podman logs محتوای نهایی را بخواند، حذف شود.
--latest, -l
بهجای وارد کردن نام یا شناسه کانتینر، از آخرین کانتینر ایجادشده استفاده میکند. نکته: آخرین کانتینر راهاندازیشده ممکن است متعلق به سایر کاربران پادمن روی سیستم میزبان باشد. (این گزینه در کلاینت ریموت پادمن، از جمله دستگاههای Mac و Windows (بهجز WSL2) در دسترس نیست)
--names, -n
نمایش نام کانتینرها بهجای شناسههای کانتینر در لاگ.
--since=TIMESTAMP
نمایش لاگها از زمان TIMESTAMP به بعد. گزینهٔ --since میتواند برچسبهای زمانی یونیکس (Unix timestamps)، برچسبهای زمانی با فرمت تاریخ، یا رشتههای مدتزمان گو (مانند 10m، 1h30m) باشد که نسبت به زمان سیستم کلاینت محاسبه میشوند. فرمتهای پشتیبانیشده برای برچسبهای زمانی با فرمت تاریخ شامل RFC3339Nano، RFC3339، 2006-01-02T15:04:05، 2006-01-02T15:04:05.999999999، 2006-01-02Z07:00 و 2006-01-02 هستند.
--tail=LINES
نمایش تعداد مشخصشده از سطرهای پایانی لاگها (LINES). مقدار LINES باید یک عدد صحیح باشد. مقدار پیشفرض ۱- است که همهٔ خطوط را چاپ میکند.
--timestamps, -t
نمایش برچسبهای زمانی در خروجیهای لاگ. مقدار پیشفرض false است.
--until=TIMESTAMP
نمایش لاگها تا زمان TIMESTAMP. گزینهٔ --until میتواند برچسبهای زمانی یونیکس، برچسبهای زمانی با فرمت تاریخ، یا رشتههای مدتزمان گو (مانند 10m، 1h30m) باشد که نسبت به زمان سیستم کلاینت محاسبه میشوند. فرمتهای پشتیبانیشده برای برچسبهای زمانی با فرمت تاریخ شامل RFC3339Nano، RFC3339، 2006-01-02T15:04:05، 2006-01-02T15:04:05.999999999، 2006-01-02Z07:00 و 2006-01-02 هستند.
مثالها (EXAMPLES)
برای مشاهدهٔ لاگهای یک کانتینر:
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
برای مشاهدهٔ فقط دو سطر پایانی در لاگ کانتینر:
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
برای مشاهدهٔ لاگهای تمام کانتینرها:
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
برای مشاهدهٔ لاگهای یک کانتینر از یک زمان خاص به بعد:
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
برای مشاهدهٔ لاگهای یک کانتینر که در ۱۰ دقیقهٔ اخیر ایجاد شدهاند:
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, Increase 'ulimit -n' when higher maxclients are required.
برای مشاهدهٔ لاگهای یک کانتینر تا ۳۰ دقیقه پیش:
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)
تاریخچه (HISTORY)
فوریه ۲۰۱۸، بهروزرسانیشده توسط Brent Baude bbaude@redhat.com ⟨mailto:bbaude@redhat.com⟩
اوت ۲۰۱۷، در ابتدا توسط Ryan Cole rycole@redhat.com گردآوری شد ⟨mailto:rycole@redhat.com⟩