Rotate Logs Older Than 7 days and Delete Archive [on hold]
up vote
-1
down vote
favorite
I'm trying to configure logrotate
to find all the log files older than 7 days from certain directories and archive them. The archived files must be deleted.
I have a structure as follows.
/var/log/myapp/subfolder1/*.log (hundreds of logs)
/var/log/myapp/subfolder2/*.log (hundreds of logs)
/var/log/myapp/subfolder3/*.log (hundreds of logs)
/var/log/myapp/subfolder4/*.log (hundreds of logs)
I know I should create a configuration file in /etc/logrotate.d/
, but how can I specify the archiving of log file older than 7 days in each directory and remove the archived files?
logs logrotate
New contributor
put on hold as unclear what you're asking by Jeff Schaller, RalfFriedl, Christopher, n.st, thrig Dec 5 at 0:12
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-1
down vote
favorite
I'm trying to configure logrotate
to find all the log files older than 7 days from certain directories and archive them. The archived files must be deleted.
I have a structure as follows.
/var/log/myapp/subfolder1/*.log (hundreds of logs)
/var/log/myapp/subfolder2/*.log (hundreds of logs)
/var/log/myapp/subfolder3/*.log (hundreds of logs)
/var/log/myapp/subfolder4/*.log (hundreds of logs)
I know I should create a configuration file in /etc/logrotate.d/
, but how can I specify the archiving of log file older than 7 days in each directory and remove the archived files?
logs logrotate
New contributor
put on hold as unclear what you're asking by Jeff Schaller, RalfFriedl, Christopher, n.st, thrig Dec 5 at 0:12
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
are you asking logrotate to rotate these files, or just delete them? You may want to use a different tool if you just want to delete old files.
– Jeff Schaller
Dec 4 at 16:26
1
Missing information: operating system name and version, name and version the of system logger, whether the logs are produced by the system logger or by the application itself, whether the application can or cannot be configured to use a system logger, etc... Also, confusion elimination, please: you first want to archive a file and then delete it? By definition, an archive is kept, not deleted. You meant rotate the logs, right, not archive?
– Christopher
Dec 4 at 18:43
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I'm trying to configure logrotate
to find all the log files older than 7 days from certain directories and archive them. The archived files must be deleted.
I have a structure as follows.
/var/log/myapp/subfolder1/*.log (hundreds of logs)
/var/log/myapp/subfolder2/*.log (hundreds of logs)
/var/log/myapp/subfolder3/*.log (hundreds of logs)
/var/log/myapp/subfolder4/*.log (hundreds of logs)
I know I should create a configuration file in /etc/logrotate.d/
, but how can I specify the archiving of log file older than 7 days in each directory and remove the archived files?
logs logrotate
New contributor
I'm trying to configure logrotate
to find all the log files older than 7 days from certain directories and archive them. The archived files must be deleted.
I have a structure as follows.
/var/log/myapp/subfolder1/*.log (hundreds of logs)
/var/log/myapp/subfolder2/*.log (hundreds of logs)
/var/log/myapp/subfolder3/*.log (hundreds of logs)
/var/log/myapp/subfolder4/*.log (hundreds of logs)
I know I should create a configuration file in /etc/logrotate.d/
, but how can I specify the archiving of log file older than 7 days in each directory and remove the archived files?
logs logrotate
logs logrotate
New contributor
New contributor
edited Dec 4 at 13:59
Christopher
10k32847
10k32847
New contributor
asked Dec 4 at 13:28
voxsteel
1
1
New contributor
New contributor
put on hold as unclear what you're asking by Jeff Schaller, RalfFriedl, Christopher, n.st, thrig Dec 5 at 0:12
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by Jeff Schaller, RalfFriedl, Christopher, n.st, thrig Dec 5 at 0:12
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
are you asking logrotate to rotate these files, or just delete them? You may want to use a different tool if you just want to delete old files.
– Jeff Schaller
Dec 4 at 16:26
1
Missing information: operating system name and version, name and version the of system logger, whether the logs are produced by the system logger or by the application itself, whether the application can or cannot be configured to use a system logger, etc... Also, confusion elimination, please: you first want to archive a file and then delete it? By definition, an archive is kept, not deleted. You meant rotate the logs, right, not archive?
– Christopher
Dec 4 at 18:43
add a comment |
1
are you asking logrotate to rotate these files, or just delete them? You may want to use a different tool if you just want to delete old files.
– Jeff Schaller
Dec 4 at 16:26
1
Missing information: operating system name and version, name and version the of system logger, whether the logs are produced by the system logger or by the application itself, whether the application can or cannot be configured to use a system logger, etc... Also, confusion elimination, please: you first want to archive a file and then delete it? By definition, an archive is kept, not deleted. You meant rotate the logs, right, not archive?
– Christopher
Dec 4 at 18:43
1
1
are you asking logrotate to rotate these files, or just delete them? You may want to use a different tool if you just want to delete old files.
– Jeff Schaller
Dec 4 at 16:26
are you asking logrotate to rotate these files, or just delete them? You may want to use a different tool if you just want to delete old files.
– Jeff Schaller
Dec 4 at 16:26
1
1
Missing information: operating system name and version, name and version the of system logger, whether the logs are produced by the system logger or by the application itself, whether the application can or cannot be configured to use a system logger, etc... Also, confusion elimination, please: you first want to archive a file and then delete it? By definition, an archive is kept, not deleted. You meant rotate the logs, right, not archive?
– Christopher
Dec 4 at 18:43
Missing information: operating system name and version, name and version the of system logger, whether the logs are produced by the system logger or by the application itself, whether the application can or cannot be configured to use a system logger, etc... Also, confusion elimination, please: you first want to archive a file and then delete it? By definition, an archive is kept, not deleted. You meant rotate the logs, right, not archive?
– Christopher
Dec 4 at 18:43
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
#While waiting for a real answer, you may wish to play w/ the following
#following alternative outline of a solution not using "logrotate"
#Needs sanity checks, failure recovery, et cetera
find $myLOGHOME -type f -mtime -7 | tee $myARCHIVE_FILES
#After archiving & renaming old files, $mySTREAM_ARCHIVER moves
#the originals to a holding directory, where they will be maintained
#for some time before eventually being deleted when they are too old
#Holding directory files remain there
$mySTREAM_ARCHIVER $myOPTIONS < $myARCHIVE_FILES
#Implementation, testing and cleanup are left as an exercise for the reader
New contributor
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
#While waiting for a real answer, you may wish to play w/ the following
#following alternative outline of a solution not using "logrotate"
#Needs sanity checks, failure recovery, et cetera
find $myLOGHOME -type f -mtime -7 | tee $myARCHIVE_FILES
#After archiving & renaming old files, $mySTREAM_ARCHIVER moves
#the originals to a holding directory, where they will be maintained
#for some time before eventually being deleted when they are too old
#Holding directory files remain there
$mySTREAM_ARCHIVER $myOPTIONS < $myARCHIVE_FILES
#Implementation, testing and cleanup are left as an exercise for the reader
New contributor
add a comment |
up vote
1
down vote
#While waiting for a real answer, you may wish to play w/ the following
#following alternative outline of a solution not using "logrotate"
#Needs sanity checks, failure recovery, et cetera
find $myLOGHOME -type f -mtime -7 | tee $myARCHIVE_FILES
#After archiving & renaming old files, $mySTREAM_ARCHIVER moves
#the originals to a holding directory, where they will be maintained
#for some time before eventually being deleted when they are too old
#Holding directory files remain there
$mySTREAM_ARCHIVER $myOPTIONS < $myARCHIVE_FILES
#Implementation, testing and cleanup are left as an exercise for the reader
New contributor
add a comment |
up vote
1
down vote
up vote
1
down vote
#While waiting for a real answer, you may wish to play w/ the following
#following alternative outline of a solution not using "logrotate"
#Needs sanity checks, failure recovery, et cetera
find $myLOGHOME -type f -mtime -7 | tee $myARCHIVE_FILES
#After archiving & renaming old files, $mySTREAM_ARCHIVER moves
#the originals to a holding directory, where they will be maintained
#for some time before eventually being deleted when they are too old
#Holding directory files remain there
$mySTREAM_ARCHIVER $myOPTIONS < $myARCHIVE_FILES
#Implementation, testing and cleanup are left as an exercise for the reader
New contributor
#While waiting for a real answer, you may wish to play w/ the following
#following alternative outline of a solution not using "logrotate"
#Needs sanity checks, failure recovery, et cetera
find $myLOGHOME -type f -mtime -7 | tee $myARCHIVE_FILES
#After archiving & renaming old files, $mySTREAM_ARCHIVER moves
#the originals to a holding directory, where they will be maintained
#for some time before eventually being deleted when they are too old
#Holding directory files remain there
$mySTREAM_ARCHIVER $myOPTIONS < $myARCHIVE_FILES
#Implementation, testing and cleanup are left as an exercise for the reader
New contributor
edited Dec 4 at 14:04
sourcejedi
22.3k43398
22.3k43398
New contributor
answered Dec 4 at 13:54
cspoleta
111
111
New contributor
New contributor
add a comment |
add a comment |
1
are you asking logrotate to rotate these files, or just delete them? You may want to use a different tool if you just want to delete old files.
– Jeff Schaller
Dec 4 at 16:26
1
Missing information: operating system name and version, name and version the of system logger, whether the logs are produced by the system logger or by the application itself, whether the application can or cannot be configured to use a system logger, etc... Also, confusion elimination, please: you first want to archive a file and then delete it? By definition, an archive is kept, not deleted. You meant rotate the logs, right, not archive?
– Christopher
Dec 4 at 18:43