##Example config for processing rotated logfiles with the revised awstats-update
##don't forget to remove those logfiles from the original configs, e.g. /etc/logrotate.d/apache2
##It might be better to just move the postrotate part into existing configs...
##that's basically all you need to make awstats process rotating logs.
##
##By default I use sharedscripts and dateext, so awstats-update will only run once per logfile
##and will find the latest previous logfile by itself.
##At the bottom is an example without use of sharedscripts and specifying the logfile explicitly.
##That makes non-standard logfile-name patterns and relocated logfiles work.

#/var/log/apache2/awstats.log  {
#    daily
#    compress
#    dateext
#    #important: delay the compression, last logfile stays uncompressed
#    delaycompress
#    rotate 99
#    maxage 30
#    size=+4096k
#    notifempty
#    missingok
#    create 644 root root
#    sharedscripts
#    postrotate
#     systemctl -q is-active apache2.service && reload apache2.service
#     sleep 20
#     umask 0027
#    /usr/sbin/awstats-update -logfile /var/log/apache2/awstats.log -previouslog
#    endscript
#}

##for squid setup see /usr/share/doc/packages/awstats/awstats-squid-setup.md

#/var/log/mail /var/log/squid/access.log.awstats
#{
#    compress
#    dateext
#    maxage 365
#    missingok
#    notifempty
#    size +4096k
#    create 640 root root
#    sharedscripts
#    #important: delay the compression, last logfile stays uncompressed
#    delaycompress
#    postrotate
#        systemctl -q is-active syslog.service && systemctl reload syslog.service
#        sleep 20
#        umask 0027
#        /usr/sbin/awstats-update -config smtp -previouslog
#        /usr/sbin/awstats-update -config squid -previouslog
#    endscript
#}

###Example not using sharedscripts

##/var/log/mail
##{
##    compress
##    dateext
##    maxage 365
##    missingok
##    notifempty
##    size +4096k
##    create 640 root root
##    #important: delay the compression, last logfile stays uncompressed
##    delaycompress
##    nosharedscripts
##    postrotate
##        systemctl -q is-active syslog.service && systemctl reload syslog.service
##        sleep 20
##        umask 0027
##        /usr/sbin/awstats-update \
##            -logfile "$1" \
##            -previouslog "$2"
##    endscript
##}
