To delete log files content older than 30 days and append the lastest date log file date in the respective logs
I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs
This is my script
cd /hyperion/logs/essbase/app
Check to find all the Essbase Application logs
find . -name *.log -exec ls {} \;
Deleting the logs file more than 30 days
find . -name *.log -mtime +30 -type f -exec rm {} \;
But the Application logs file content which are older than 30 days not getting deleted and not appending the lastest date in the application log file
cd /hyperion/logs/essbase/app
cat *.Demo.log*
current format
[Thu Sep 13 16:00:13 2012]Local/Demo///1/Info(1002035)
Starting Essbase Server - Application [Demo]
[Thu Sep 13 16:00:14 2012]Local/Demo///1/Info(1200480)
Loaded and initialized JVM module
[Thu Sep 13 16:00:14 2012]Local/Demo///1/Info(1200445)
External [GLOBAL] function [@ESSBASEALERT] registered OK
Tue*Nov*27*19:09:52*2012*Local*Demo***1*Info*(1024033)*Missing Database Config File *[/essbase/hyperion/products/Essbase/EssbaseServer/app/Demo/Demo/Demo.cfg]*, Query logging disabled
Tue*Nov*27*19:09:52*2012*Local*Demo***1*Info*(1203135)*Starting the Data Mining Framework
Tue*Nov*27*19:09:52*2012*Local*Demo***1*Info*(1203136)*Data Mining Framework successfully initialized.
Tue*Nov*27*19:09:52*2012*Local*Demo***1*Info*(1200551)*Allocated TRIGMAXMEMSIZE: *[4096]* Bytes.
Tue*Nov*27*19:09:52*2012*Local*Demo***1*Info*(1013205)*Received Command *[Get Database Volumes]
Tue*Nov*27*19:09:52*2012*Local*Demo***1*Info*(1013205)*Received Command *[Set Database State]
Tue*Nov*27*19:09:52*2012*Local*Demo***1*Info*(1019018)*Writing Parameters For Database *[Demo]
Tue*Nov*27*19:09:52*2012*Local*Demo***1*Info*(1019018)*Writing Parameters For Database *[Demo]
Tue*Nov*27*19:09:52*2012*Local*Demo***1*Info*(1013205)*Received Command *[Get Database State]
I want to remove sep month data in log file and only need to have Nov months data in the log file
ie Oct 29 - Nov 29 dates appearing inside the log file.like i have 5 application log files.Please have a solutions for this