RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1763007 - --log-opt for podman run does not work as expected
Summary: --log-opt for podman run does not work as expected
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: podman
Version: 8.3
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: 8.4
Assignee: Jindrich Novy
QA Contact: Alex Jia
URL:
Whiteboard:
Depends On:
Blocks: 1186913 1823899
TreeView+ depends on / blocked
 
Reported: 2019-10-18 03:38 UTC by Suhaas Bhat
Modified: 2023-10-06 18:41 UTC (History)
15 users (show)

Fixed In Version: podman-3.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-18 15:32:02 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Suhaas Bhat 2019-10-18 03:38:38 UTC
Description of problem:
Even though we can change the logging drivers for podman using --log-driver but we cannot set the configs for them. --log-opt option values is not taken up by podman. 

E;g for json-file and k8s-file max-file and max-size cannot be set.


"HostConfig": {
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "k8s-file",
                "Config": {}
            },

"HostConfig": {
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },

Version-Release number of selected component (if applicable):

podman-1.4.4-4.el7.x86_64

Additional info:
https://github.com/containers/libpod/pull/1773

Any updates after above changes ?

Comment 2 Derrick Ornelas 2019-10-18 13:00:30 UTC
We appear to list max-file and max-size as being supported options here:

  https://github.com/containers/libpod/blob/v1.4.4/completions/bash/podman#L500

but they don't seem to be defined anywhere else.

Comment 3 Matthew Heon 2019-10-18 13:18:06 UTC
Podman supports a (limited) set of log drivers, but does not presently support setting options for these drivers. Are there any specific options that you want to use?

Comment 6 Daniel Walsh 2019-10-23 13:59:05 UTC
We might be able to do something here, but realize that we don't have a long running daemon, unless conmon could handle this.  I guess max-size and max-files would rename the existing log file to annother name and then start writing a new log file. Then if we had three renames, would remove the oldest.

Comment 7 Daniel Walsh 2019-10-23 14:03:01 UTC
conmon has a --log-max-size option now.

Comment 8 Daniel Walsh 2019-10-23 14:03:40 UTC
Oops typo above
conmon --help
...
  --log-size-max              Maximum size of log file

Comment 10 Daniel Walsh 2019-10-23 14:12:06 UTC
My quick read of the code looks like conmon just truncates the file, I might have missed it, but I don't see it rename the previous version.

Comment 11 Derrick Ornelas 2020-04-20 16:50:33 UTC
As Red Hat Enterprise Linux 7 is now in its Maintenance Support 1 phase[1] no new software functionality is planned.  We are moving this request to Red Hat Enterprise Linux 8 where it may be considered for inclusion in a future minor release.  

[1]
https://access.redhat.com/support/policy/updates/errata#Maintenance_Support_1_Phase

Comment 12 Daniel Walsh 2020-06-03 14:19:08 UTC
Assign an intern.

Comment 13 Daniel Walsh 2020-09-11 19:36:36 UTC
Giuseppe could you look at this?

Comment 15 PRATIBHA MOOGI 2020-11-26 13:10:12 UTC
Do we have supported this in the latest Podman version ?

Comment 16 Giuseppe Scrivano 2020-11-27 09:29:29 UTC
no, this is not supported yet

Comment 17 Daniel Walsh 2021-01-29 10:37:39 UTC
This seems to work somewhat

./bin/podman run -d --log-opt max-size=1m alpine sleep 500

Which passes to conmon the 
--log-size-max 1000000 
flag.

I don't believe this is perfect, but it does satisfy the requirement.

Comment 21 Alex Jia 2021-02-01 12:32:16 UTC
It works on podman-3.0.0-0.33rc2.module+el8.4.0+9742+44abad1f.

[root@kvm-03-guest13 ~]# rpm -q podman
podman-3.0.0-0.33rc2.module+el8.4.0+9742+44abad1f.x86_64

[root@kvm-03-guest13 ~]# podman run -d --log-opt max-size=1m alpine sleep 500
e02f18ec462ea0f8159ada5c706d83eba72782113fc87d009623aab64ebe9799

[root@kvm-03-guest13 ~]# podman inspect pedantic_shannon | grep -i max-size
                "max-size=1m",

@subhat, please give a double check on k8s/OCP environment, thanks a lot!

Comment 22 Alex Jia 2021-02-09 06:25:46 UTC
Also verified on podman-3.0.0-0.38rc2.module+el8.4.0+9804+5385893b.x86_64
w/ crun-0.17-1.module+el8.4.0+9804+5385893b.x86_64.

# podman run -d --log-opt max-size=1m alpine sleep 500
24a2cc1fb81c482c2342d14d21ae8bab964e7321dfdec98961bf77316fafdbf2

# podman ps
CONTAINER ID  IMAGE                           COMMAND           CREATED         STATUS             PORTS                 NAMES
24a2cc1fb81c  alpine                          sleep 500         13 seconds ago  Up 13 seconds ago                        sweet_elion

# podman inspect sweet_elion | grep -i max-size
                "max-size=1m",

Comment 24 errata-xmlrpc 2021-05-18 15:32:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: container-tools:rhel8 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:1796


Note You need to log in before you can comment on or make changes to this bug.