Bug 1763007

Summary: --log-opt for podman run does not work as expected
Product: Red Hat Enterprise Linux 8 Reporter: Suhaas Bhat <subhat>
Component: podmanAssignee: Jindrich Novy <jnovy>
Status: CLOSED ERRATA QA Contact: Alex Jia <ajia>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.3CC: bbaude, dornelas, dwalsh, fsayyed, gscrivan, jligon, jnovy, lsm5, mheon, mpatel, pehunt, pmoogi, tsweeney, umohnani, ypu
Target Milestone: rcKeywords: FutureFeature
Target Release: 8.4   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: podman-3.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:32:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1186913, 1823899    

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