Logrotate Issue, New file doesn't hav new active logs and file is uncompresed. Lost logs of both files.

hammad9199

New Member
Joined
Sep 16, 2020
Messages
1
Reaction score
0
Credits
25
Hi Everyone !
Need urgent help... goal is to enable logrotate on a file. Size is 1.1 GB, BSMSCharging.log is the file name. File has active logs coming every minute. New created file should have new log entries while need previous log file should have logs of last 14 days.
My approach was like this, i created a file in /etc/logrotate.d directory. code i wrote is .....
/opt/modules/logs/BSMSCharging.log {
daily
rotate 14
compress
dateext
create 644 root root
postrotate
/opt/modules/logs/archive_logs
endscripts
}
archive_log is the directory where i wanted to save the new created zip file.

My output was.... 'BSMSCharging.log' was empty. New file was created by the name 'BSMSCharging.log-20200916' it has now all the logs data and new logs are updating in this file, but this file is not zipped. Questions: BSMSCharging.log should not have the new active logs showing ? why isn't file zipped and not copied in the archive_log directory ?

Next i changed my code ....

weekly
rotate 2
compress
dateext
create 644 root root
postrotate
/opt/modules/logs/archive_logs
endscripts
}

Output... lost log record from both the files and even new active logs are not showing up now ? Reason and Solution ?

Next i changed ...

i removed postrotate, now new file BSMSCharging.log-20200916.gz is zipped but i lost all the logs.

Need guidance... i want to send logs of 14 days in zipped file while new logs should be created in previous original file ?
Please clear my concepts and help me resolve this issue immediately... Thank You

PLZ CHECKED THE ATTACHED PICTURES. HELP ME COMPLETE MY TASK

picture are in order mentioned above. picture are just to get the idea.


1600278526175.png





Now after removing postrotate, BSMSCharging.log-2020916.gz is compressed but does not have logs, previous or new active ones.

Please help me completing my task
 


G'day @hammad9199 and welcome to linux.org :)

I am moving this Thread to Command Line, where such matters get more expert attention.

Good luck

Chris Turner
wizardfromoz
 

Members online


Top