Author Topic: Tomcat log files taking up to much disk space  (Read 9705 times)

rudio

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
    • Email
Tomcat log files taking up to much disk space
« on: February 11, 2009, 13:31:09 »
du -sm /usr/local/queuemetrics/tomcat/logs/*
Shows log files of 600mb per day. How do I decrease or turn of these logs for tomcat?
Any ideas welcome.

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Tomcat log files taking up to much disk space
« Reply #1 on: February 11, 2009, 14:09:03 »
You could simply rotate them daily using a logrotate job like:

Code: [Select]
/usr/local/queuemetrics/tomcat/logs/*.* {
   missingok
   rotate 5
   daily
   compress
   create 0640 root root
   postrotate
       /etc/init.d/queuemetrics restart > /dev/null 2> /dev/null
   endscript
}

You can decide how much to keep them for (in the example, 5 days compressed). They should compress very well.



gb_delti

  • Newbie
  • *
  • Posts: 22
  • Karma: 0
    • View Profile
Re: Tomcat log files taking up to much disk space
« Reply #2 on: December 10, 2009, 12:04:49 »
I have this problem too. While rotating the logs is ok, it would be better if they weren't so big in the first place. Is there any way to make QueueMetrics less "chatty"?

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Tomcat log files taking up to much disk space
« Reply #3 on: December 11, 2009, 09:04:27 »
Unfortunately. not at the moment.
It should not be overly chatty anyway - it should just log a couple of lines per transaction.

WRP

  • Jr. Member
  • **
  • Posts: 57
  • Karma: 1
    • View Profile
Re: Tomcat log files taking up to much disk space
« Reply #4 on: February 27, 2010, 19:30:32 »
I'm having the same problem.  We've been running queuemetrics for about two months and our tomcat logs folder has reached 32G!  This is a server that generally has three callers being serviced in a queue at any given time.  Is this a normal size?  We've been having a lot of issues with asterisk queues acting up (stuck calls, etc).  Could there be any indicators in this log file of bigger problems seeing that the size is so huge?

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Tomcat log files taking up to much disk space
« Reply #5 on: March 01, 2010, 09:17:47 »
No - as long as you have free space on the disk, and unless you see your machine hung on "wait for I/O".
I think you could disable log files at all.

See http://wiki.apache.org/tomcat/FAQ/Logging


WRP

  • Jr. Member
  • **
  • Posts: 57
  • Karma: 1
    • View Profile
Re: Tomcat log files taking up to much disk space
« Reply #6 on: March 02, 2010, 20:30:13 »
This was a bit of a hairy one.  To those interested in disabling all logging, here are the changes I made:

Code: [Select]
[root@PBX ~]# diff /usr/local/queuemetrics/tomcat/conf/server.xml.original /usr/local/queuemetrics/tomcat/conf/server.xml
163,165d162
<       <Logger className="org.apache.catalina.logger.FileLogger"
<               prefix="catalina_log." suffix=".txt"
<               timestamp="true"/>
373,376d369
<         <Logger className="org.apache.catalina.logger.FileLogger"
<                  directory="logs"  prefix="localhost_log." suffix=".txt"
<             timestamp="true"/>
<
[root@PBX ~]# diff /usr/local/queuemetrics/tomcat/bin/catalina.sh.original /usr/local/queuemetrics/tomcat/bin/catalina.sh
206d205
<   touch "$CATALINA_BASE"/logs/catalina.out
218c217
<       >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
---
>       >> /dev/null 2>&1 &
230c229
<       >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
---
>       >> /dev/null 2>&1 &

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Tomcat log files taking up to much disk space
« Reply #7 on: March 03, 2010, 09:22:13 »
That's great! If you don't mind, I'd add that to the FAQs.

WRP

  • Jr. Member
  • **
  • Posts: 57
  • Karma: 1
    • View Profile
Re: Tomcat log files taking up to much disk space
« Reply #8 on: March 03, 2010, 19:18:39 »
Go right ahead.  Hope it helps others!

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Tomcat log files taking up to much disk space
« Reply #9 on: March 04, 2010, 16:11:13 »
Thanks!