Skip to content

Instantly share code, notes, and snippets.

@AFaust
Created May 2, 2017 07:26
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AFaust/68a93c1164b09907e896e5ec76c9d073 to your computer and use it in GitHub Desktop.
Save AFaust/68a93c1164b09907e896e5ec76c9d073 to your computer and use it in GitHub Desktop.
Alfresco logrotate.d examples - able to handle compress and clear historic timestamped log files
/opt/alfresco/tomcat/logs/catalina.out {
daily
rotate 27
notifempty
missingok
compress
delaycompress
copytruncate
}
/opt/alfresco/tomcat/logs/dummy {
rotate 0
daily
create
ifempty
missingok
lastaction
/usr/bin/find /opt/alfresco/tomcat/logs/localhost_access_log.*.txt.gz -daystart -mtime +26 -delete
/usr/bin/find /opt/alfresco/tomcat/logs/alfresco.log.*.gz -daystart -mtime +26 -delete
/usr/bin/find /opt/alfresco/tomcat/logs/localhost_access_log.????-??-??.txt -daystart -mtime +1 -exec gzip -q '{}' \;
/usr/bin/find /opt/alfresco/tomcat/logs/alfresco.log.????-??-?? -daystart -mtime +1 -exec gzip -q '{}' \;
endscript
}
/opt/share/tomcat/logs/catalina.out {
daily
rotate 27
notifempty
missingok
compress
delaycompress
copytruncate
}
/opt/share/tomcat/logs/dummy {
rotate 0
daily
create
ifempty
missingok
lastaction
/usr/bin/find /opt/share/tomcat/logs/localhost_access_log.*.txt.gz -daystsart -mtime +26 -delete
/usr/bin/find /opt/share/tomcat/logs/share.log.*.gz -daystart -mtime +26 -delete
/usr/bin/find /opt/share/tomcat/logs/localhost_access_log.????-??-??.txt -daystart -mtime +1 -exec gzip -q '{}' \;
/usr/bin/find /opt/share/tomcat/logs/share.log.????-??-?? -daystart -mtime +1 -exec gzip -q '{}' \;
endscript
}
/opt/solr/tomcat/logs/catalina.out {
daily
rotate 27
notifempty
missingok
compress
delaycompress
copytruncate
}
/opt/solr/tomcat/logs/dummy {
rotate 0
daily
create
ifempty
missingok
lastaction
/usr/bin/find /opt/solr/tomcat/logs/localhost_access_log.*.gz.txt -daystart -mtime +26 -delete
/usr/bin/find /opt/solr/tomcat/logs/solr.log.*.gz -daystart -mtime +26 -delete
/usr/bin/find /opt/solr/tomcat/logs/localhost_access_log.????-??-??.txt -daystart -mtime +1 -exec gzip -q '{}' \;
/usr/bin/find /opt/solr/tomcat/logs/solr.log.????-??-?? -daystart -mtime +1 -exec gzip -q '{}' \;
endscript
}
@Rosch94
Copy link

Rosch94 commented Aug 22, 2017

Nice Ty

@jovimon
Copy link

jovimon commented Jun 11, 2018

Thank you very much for your scripts.
I have Bitnami version of Alfresco (https://bitnami.com/stack/alfresco) and this is the modified version of the script I ended up using:

/opt/alfresco/apache-tomcat/logs/catalina.out {
        daily
        rotate 27
        notifempty
        missingok
        compress
        delaycompress
        copytruncate
}

/opt/alfresco/apache-tomcat/logs/dummy {
        rotate 0
        daily
        create
        ifempty
        missingok
        lastaction
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/localhost_access_log.*.txt.gz -daystart -mtime +26 -delete
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/alfresco.log.*.gz -daystart -mtime +26 -delete
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/share.log.*.gz -daystart -mtime +26 -delete
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/solr.log.*.gz -daystart -mtime +26 -delete
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/catalina.*.log.gz -daystart -mtime +26 -delete
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/localhost_access_log.????-??-??.txt -daystart -mtime +1 -exec gzip -q '{}' \;
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/alfresco.log.????-??-?? -daystart -mtime +1 -exec gzip -q '{}' \;
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/share.log.????-??-?? -daystart -mtime +1 -exec gzip -q '{}' \;
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/solr.log.????-??-?? -daystart -mtime +1 -exec gzip -q '{}' \;
                /usr/bin/find /opt/alfresco/apache-tomcat/logs/catalina.????-??-??.log -daystart -mtime +1 -exec gzip -q '{}' \;
        endscript
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment