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 1225739 - RFE: Add age to remove file types opf systemd-tmpfiles
Summary: RFE: Add age to remove file types opf systemd-tmpfiles
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks: 1298243 74systemd 1393867
TreeView+ depends on / blocked
 
Reported: 2015-05-28 07:12 UTC by Fred van Zwieten
Modified: 2020-09-10 09:23 UTC (History)
9 users (show)

Fixed In Version: systemd-219-35.el7
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 09:09:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1466913 0 None None None Never
Red Hat Product Errata RHBA-2017:2297 0 normal SHIPPED_LIVE systemd bug fix and enhancement update 2017-08-01 12:40:16 UTC

Description Fred van Zwieten 2015-05-28 07:12:35 UTC
Description of problem:
There is a need to clean content from a directory based on age, but only if the directory exists. Filetype D in a tmpfiles.d conf file doesn't work, because it will create the directory if it doesn't exist. R doesn't use the age parameter.

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


How reproducible:
Use a tmpfiles conf of:
D /root/saplogs 755 root root 5d -

Steps to Reproduce:
1. Create a /etc/tmpfiles.d/tmpfiles conf of: "D /root/saplogs 755 root root 5d -"
2. run systemd-tmpfiles --clean
3. look at /root, there how is a subdir "saplogs"

Actual results:
a directory /root/saplogs exists

Expected results:
nothing happened

Additional info:
Propose to have the age parameter also work for r and R filetypes. This is imo backwards compatible and as such an enhancement.

Comment 2 Lukáš Nykrýn 2015-05-28 09:29:00 UTC
What is the real use-case for this? Usually you want the directory there.

Comment 3 Fred van Zwieten 2015-06-01 20:41:28 UTC
application admin installs sap components using sudo. sap leaves install logs in /root in a subdir saplog/. application admins cannot remove those because of permissions. sys admins want this directory cleaned out after x days. If the subdir saplog/ doesn't exist, nothing have to happen.

Comment 5 Lukáš Nykrýn 2015-06-04 15:18:11 UTC
(In reply to Fred van Zwieten from comment #3)
Uh this is so wrong. User who does not have access to /root directory runs an application which writes logs to /root? At least please tell you customer to file a bug against sap to move those to /var.

Tmpfilesd is about actions which happens repeatedly, what you want to do is just plan some action to the future. Also remove actions are only bound to boot (we only call /usr/bin/systemd-tmpfiles --clean in the timer).

I spend quite a lot of time thinking about a sane use-case, but I haven't found one. I really think that introducing such possibility would lead to really bad practices like the one above.

Comment 6 Ron van der Wees 2015-07-01 15:57:11 UTC
(In reply to Lukáš Nykrýn from comment #5)
Reopening this bug as I think there is a valid use case.

> (In reply to Fred van Zwieten from comment #3)
> Uh this is so wrong. User who does not have access to /root directory runs
> an application which writes logs to /root?
You are absolutely right but there are other uses cases.
With RHEL7, systemd-tmpfiles seems to have deprecated tmpwatch. The latter is
not installed by default and for example the X11 lock files are now cleaned by
/usr/lib/tmpfiles.d/x11.conf. Lets say, the customer just wants to use the new
technology as shipped with RHEL7 to clean a file in some directory under, lets
say, /var. Though if it doesn't exists (i.e. some application did not create
the directory yet), it should not be created as part of a housekeeping job.

> Tmpfilesd is about actions which happens repeatedly, what you want to do is
> just plan some action to the future. Also remove actions are only bound to
> boot (we only call /usr/bin/systemd-tmpfiles --clean in the timer).
Yes, and when the r/R type has an age defined, they should be actioned by
--clean as well (triggered by the timer).

Comment 7 Ron van der Wees 2015-08-17 07:04:50 UTC
Hi Lukas, Appreciate your feedback on comment#6 with regards to the use case.

Comment 9 Jan Synacek 2016-11-10 12:01:09 UTC
I believe that what Fred asks for was already implemented upstream:

https://github.com/systemd/systemd/commit/df8dee85da5fa41e95dd7f536e67fcc6940a6488

Comment 12 Jan Synacek 2017-04-11 13:48:17 UTC
https://github.com/lnykryn/systemd-rhel/pull/106

Comment 13 Lukáš Nykrýn 2017-04-11 15:55:20 UTC
fix merged to upstream staging branch ->
https://github.com/lnykryn/systemd-rhel/commit/f2d7881cf56b2d1448b9e09c46c076a14a05011d
-> post

Comment 16 errata-xmlrpc 2017-08-01 09:09:52 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, 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/RHBA-2017:2297


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