Bug #17770

foreman-debug does not preserve timestamps of log files

Added by Zach Huntington-Meath 10 months ago. Updated 3 months ago.

Status:Closed
Priority:Normal
Assigned To:Anurag Patel
Category:foreman-debug
Target version:-
Difficulty: Bugzilla link:1365847
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4449
Story points-
Velocity based estimate-
Release1.15.3Release relationshipAuto

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1365847
Description of problem:
The foreman plugin of sosreport does not preserve the timestamps of the log files.

Version-Release number of selected component (if applicable):
sos-3.2-35.el7_2.3

How reproducible:
Always

Steps to Reproduce:
1. Run sosreport with the foreman plugin enabled
2. Check the timestamps of the files at sos_commands/foreman/foreman-debug/var/log/tomcat
3.

Actual results:
$ ls gG
total 2260
-rw-r--r-
. 1 15379 Aug 5 08:46 catalina.2015-12-21.log
rw-r--r-. 1 15411 Aug 5 08:46 catalina.2015-12-22.log
rw-r--r-. 1 78313 Aug 5 08:46 catalina.2015-12-23.log
rw-r--r-. 1 47212 Aug 5 08:46 catalina.2015-12-24.log
rw-r--r-. 1 94245 Aug 5 08:46 catalina.2015-12-29.log
rw-r--r-. 1 15737 Aug 5 08:46 catalina.2015-12-31.log
rw-r--r-. 1 47163 Aug 5 08:46 catalina.2016-01-27.log
rw-r--r-. 1 62955 Aug 5 08:46 catalina.2016-01-28.log
rw-r--r-. 1 15690 Aug 5 08:46 catalina.2016-02-10.log
rw-r--r-. 1 56829 Aug 5 08:46 catalina.2016-02-16.log
rw-r--r-. 1 110275 Aug 5 08:46 catalina.2016-03-01.log
rw-r--r-. 1 31350 Aug 5 08:46 catalina.2016-03-03.log
rw-r--r-. 1 48059 Aug 5 08:46 catalina.2016-03-16.log
rw-r--r-. 1 47455 Aug 5 08:46 catalina.2016-04-06.log
rw-r--r-. 1 62993 Aug 5 08:46 catalina.2016-04-15.log
rw-r--r-. 1 293767 Aug 5 08:46 catalina.2016-04-19.log
rw-r--r-. 1 15683 Aug 5 08:46 catalina.2016-04-22.log
rw-r--r-. 1 78975 Aug 5 08:46 catalina.2016-04-25.log
rw-r--r-. 1 220029 Aug 5 08:46 catalina.2016-05-04.log
rw-r--r-. 1 15805 Aug 5 08:46 catalina.2016-05-10.log
rw-r--r-. 1 47093 Aug 5 08:46 catalina.2016-05-11.log
rw-r--r-. 1 126007 Aug 5 08:46 catalina.2016-05-17.log
rw-r--r-. 1 15738 Aug 5 08:46 catalina.2016-05-18.log
rw-r--r-. 1 31362 Aug 5 08:46 catalina.2016-05-26.log
rw-r--r-. 1 47180 Aug 5 08:46 catalina.2016-06-14.log
rw-r--r-. 1 49010 Aug 5 08:46 catalina.2016-07-08.log
rw-r--r-. 1 46999 Aug 5 08:46 catalina.2016-07-13.log
rw-r--r-. 1 15692 Aug 5 08:46 catalina.2016-07-14.log
rw-r--r-. 1 260007 Aug 5 08:46 catalina.2016-07-27.log
rw-r--r-. 1 40708 Aug 5 08:46 catalina.2016-07-28.log
rw-r--r-. 1 280 Aug 5 08:46 catalina.2016-07-29.log
rw-r--r-. 1 40206 Aug 5 08:46 catalina.2016-07-30.log
rw-r--r-. 1 60118 Aug 5 08:46 catalina.2016-08-02.log
rw-r--r-. 1 9712 Aug 5 08:46 catalina.2016-08-03.log
rw-r--r-. 1 10050 Aug 5 08:46 catalina.2016-08-04.log
rw-r--r-. 1 9676 Aug 5 08:46 catalina.2016-08-05.log

Expected results:
Timestamps of files collected by foreman plugin are preserved.

Additional info:

Associated revisions

Revision c0e6e3d6
Added by Anurag Patel 6 months ago

Fixes #17770 - Preserve timestamps for collected files.

Uses `touch -r` to use the source file/dir as a reference and
replicate timestamps over to the file collected inside
foreman-debug archive.

Revision 0b8c9959
Added by Anurag Patel 2 months ago

Fixes #17770 - Preserve timestamps for collected files.

Uses `touch -r` to use the source file/dir as a reference and
replicate timestamps over to the file collected inside
foreman-debug archive.

(cherry picked from commit c0e6e3d686919cd0e33c3c8decc93dd39e5632e0)

History

#1 Updated by Dominic Cleal 10 months ago

  • Assigned To deleted (Lukas Zapletal)
  • Priority changed from High to Normal

#2 Updated by Anurag Patel 7 months ago

Looks like foreman-debug doesn't actually copy the files/logs to its archive. It does a *cat on the files, filters strings and writes into the archive, thereby giving the target files new timestamp. It should be possible to use touch -r to copy the timestamps too.

#3 Updated by The Foreman Bot 6 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4449 added

#4 Updated by Anonymous 6 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Anurag Patel 6 months ago

  • Status changed from Closed to Resolved
  • Assigned To set to Anurag Patel

PR merged

#6 Updated by Dominic Cleal 6 months ago

  • Status changed from Resolved to Closed

#7 Updated by Eric Helms 3 months ago

  • Release set to 1.15.3

Also available in: Atom PDF