Bug 1486952

Summary: add_copy_spec with sizelimit prefers older files if they are in ${FILENAME}.YYYYMMDD format
Product: Red Hat Enterprise Linux 7 Reporter: Pavel Moravec <pmoravec>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Jan Houska <jhouska>
Severity: medium Docs Contact:
Priority: high    
Version: 7.4CC: agk, bmr, gavin, jhouska, mhradile, plambri, sbradley
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: https://github.com/sosreport/sos/pull/1082
Whiteboard:
Fixed In Version: sos-3.5-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1567071 (view as bug list) Environment:
Last Closed: 2018-04-10 18:04:13 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: 1567071    

Description Pavel Moravec 2017-08-30 21:18:04 UTC
Description of problem:
(derived from https://bugzilla.redhat.com/show_bug.cgi?id=1304394#c9)

Calling e.g.:

self.add_copy_spec("/var/log/secure*", sizelimit=self.limit)

for a low log_size / sizelimit collects /var/log/secure and then the _oldest_ secure.* file instead of newest ones.

The reason is, we order the files alphanumerically. That works well for /var/log/messages.1 style of log-rotating only.


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


How reproducible:
100%


Steps to Reproduce:
1. Have /var/log/secure* (or /var/log/messages*) with many ~1MB files, log-rotated with timestamp suffix like /var/log/secure-20170828
2. sosreport -o logs --log-size=10
3. Check collected secure* or messages* files


Actual results:
- /var/log/messages and then _oldest_ files are collected
- same applies for /var/log/secure files


Expected results:
- /var/log/messages and then other _newest_ files should be collected
- same should apply for /var/log/secure files

Additional info:

Comment 1 Pavel Moravec 2017-11-02 15:16:16 UTC
Fixed via sos 3.5 rebase.

Comment 10 errata-xmlrpc 2018-04-10 18:04:13 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/RHEA-2018:0963