On 8/3/17 5:47 AM, Martin Knoblauch wrote:
> is there a way to compress the localhost_access_log.#####.txt file 
> automatically after rotation?

There is, but maybe not one built into Tomcat.  I have a daily cron
job to run a script which looks for older logs and ZIPs them:

LOGDIR=/var/log/tomcat-7

ZIP_OPTS='-9mou'

# localhost
for LOG in $(find ${LOGDIR} -mtime +7 -name localhost.????-??-??.log | sort); do
  YEAR=$(echo ${LOG} | cut -d. -f2 | cut -d- -f1)
  zip ${ZIP_OPTS} /var/biglogs/tomcat/localhost.log.${YEAR}.zip ${LOG}
done

I have a bunch of these blocks in the script, so I ought to make one
into a function and just call it N times with various arguments, but
this works for me.

-- 
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu

Attachment: signature.asc
Description: PGP signature

Reply via email to