troubleshooting Question

how to include conditional log rotate in liunx.

Avatar of BharathKumarRaju DasaraRaju
BharathKumarRaju DasaraRajuFlag for India asked on
Shell ScriptingLinux DistributionsLinux
17 Comments3 Solutions940 ViewsLast Modified:
Hi Team,

I am little bit confused with log rotate, Could anyone help me in doing log rotate as below.

1. I would like to write a condition inside linux log rotate that first it need to check the log file size , if it is more than 1GB then it should gzip the log file and should purge it.
2. If the above condition didn't match for the specified log files i would like to retain the 3 days of log files and remove more than 3days of log files.

I didn't know how to put condition to handle this?

Join our community to see this answer!
Unlock 3 Answers and 17 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros