Bug 752435

Summary: logrotate for mgetty is wrong (tty -> tty*, mgetty.callback -> mgetty.log.callback)
Product: [Fedora] Fedora Reporter: giulioo
Component: mgettyAssignee: Michal Sekletar <msekleta>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: fabrice, jskala, msekleta
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-28 23:54:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description giulioo 2011-11-09 13:46:52 UTC
Description of problem:
/etc/logrotate.d/mgetty contains:
 /var/log/mgetty.log.tty /var/log/mgetty.log.unknown /var/log/mgetty.callback

Problem n.1: it should be mgetty.log.tty*     instead of mgetty.log.tty
Problem n.2: it should be mgetty.log.callback instead of mgetty.callback

Version-Release number of selected component (if applicable):
mgetty-1.1.36-13.fc17.src.rpm  

How reproducible:
Always

Steps to Reproduce n.1:
1. Start mgetty on ttyS0
2. See that /var/log/mgetty.log.ttyS0 is created
3. Run: logrotate -f /etc/logrotate.conf
4. See that log file is not rotated
  
Steps to Reproduce n.2:
1. Run: callback 1234
2. See that /var/log/mgetty.log.callback is created
3. Run logrotate -f /etc/logrotate.conf
4. See that log file is not rotated

Actual results:
Log files not rotated

Expected results:
Log files rotated

Additional info:
I'm using CentOS and not Fedora, however I understand that CentOS is based on RHEL, which is based on Fedora, so I downloaded the latest mgetty src.rpm from Fedora rawhide and checked logrotate.mgetty; since the problem is still there I thought that the best thing is for it to be fixed in Fedora so that it will trickle down to CentOS some day.

Comment 1 Michal Sekletar 2011-11-10 16:24:31 UTC
Fixed in rawhide -> http://lists.fedoraproject.org/pipermail/scm-commits/2011-November/682315.html -> Modified

Comment 2 giulioo 2012-04-01 13:17:06 UTC
It seems there's a problem with the setup I proposed.

I assumed (didn't understand the syntax) that the existing line
  tabooext + mgetty.log.tty*[-.]*
at the beginning of the logrotate file was meant to protect against rotating already rotated logs, hence my proposal of
  mgetty.log.tty*

However, I actually got log file rotated multiple times.

So I looked up "tabooext" in the man page, and it seems it's meant to avoid reading in config files (ie: include directive) not to avoid processing files to be rotated.

So, since I don't know how to solve this, for now I went back to the RHEL5 file, the one with the multiple
   /var/log/mgetty.log.tty[^.] /var/log/mgetty.log.tty[^.][^.] .....

Comment 3 Fabrice Bellet 2013-01-08 10:50:06 UTC
I confirm that tabooext is intended to exclude config files from being loaded, not logfiles, so I think that enumerating the ttyXXX with all their possible length is probably the best workaround given the glob wildcard matching capabilities.

Comment 4 Michal Sekletar 2013-01-08 15:05:17 UTC
(In reply to comment #3)
> I confirm that tabooext is intended to exclude config files from being loaded

Agreed. Rotating of logs is indeed broken. I should have examined more, before committing a "fix". Since I don't use mgetty very often, I didn't realize it is actually broken. Sorry for that. 

> enumerating the ttyXXX with all their possible length is probably the best
> workaround given the glob wildcard matching capabilities.

This scheme works, but it is a completely horrible. We should have something better. I am not sure what would be the best approach here.

Comment 5 Michal Sekletar 2013-01-10 10:12:55 UTC
I think that best approach here would be changing naming scheme for mgetty log files. New filenames will be matched by following wildcard /var/log/mgetty.tty*.log. I will change it in F19 and in F18 I will use logrotate configuration from RHEL5.

Comment 6 Fedora End Of Life 2013-04-03 19:34:24 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 7 Michal Sekletar 2014-03-28 23:54:28 UTC
I have changed naming scheme of log files and adjusted logrotate configuration accordingly.