Posts

Showing posts with the label logrotate

How to set max size for a specific file in linux

Image
Clash Royale CLAN TAG #URR8PPP How to set max size for a specific file in linux I have an application which will write to a particular log file until the user session is going on. What i am looking for is to put a max cap on the size of a log file so it does not grow beyond a particular size, 2 scenarios which will be useful are Any utility which keeps an eye on the log file and as soon as it reaches the max size start truncating the file content from the start so the application can keep appending the content at the end. Any utility by which while creating the file i can specify the max size of that file and when file reaches that maxsize it should simply not grow beyond that point. What i don't want is man logrotate – Cyrus Dec 17 '17 at 10:46 man logrotate @NiallCosgrove How to put a cap on the size o...

Logrotate daily+maxsize is not rotating

Image
Clash Royale CLAN TAG #URR8PPP Logrotate daily+maxsize is not rotating I've CentOS 7.4 with logrotate 3.8.6 installed. I've a custom logrotate file under /etc/logrotate.d/ to rotate some logs on a Tomcat (e.g., catalina.out) which is installed in the same machine. /etc/logrotate.d/ /opt/test/apache-tomcat-8.5.15-client/logs/catalina.out { copytruncate daily rotate 30 olddir /opt/test/apache-tomcat-8.5.15-client/logs/backup compress missingok maxsize 50M dateext dateformat .%Y-%m-%d } I want the log to be rotated daily or if the size reaches 50MB. When this happens log files are compressed and copied into a backup folder and are kept for 30 days before being deleted. I already ran logrotate manually in debug mode with the following command and no errors were displayed (and the expected zipped log files were created): /usr/sbin/logrotate -d /etc/logrotate.d/openncp-tomcat-backoffice 2> /tmp/logrotate.debug /usr/sbin/logrotate -d /etc/logrotate.d/openncp-tomcat-backoffice 2...