7

My access.log files are HUGE!!!

-rw-r--r-- 1 app dev 745M Sep 24 00:00 access_log.2015-09-23.log
-rw-r--r-- 1 app dev 772M Sep 25 00:00 access_log.2015-09-24.log
-rw-r--r-- 1 app dev 527M Sep 25 17:54 access_log.2015-09-25.log

They already rotate per day (default), but I am trying to figure out how to compress them after they rotate. The only information I can find about the tomcat access log is this https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Access_Log_Valve

But it doesnt give any information about compression. I am able to roll/compress my other logs via logback but am unsure how to use logback to configure the tomcat access log (if its possible). I am using embedded Tomcat 7.0.55 with Spring-Boot 1.2.6.RELEASE.

I guess i could cron the compression daily. Would just like to find the "right" solution.

Any and all information would be greatly appreciated.

  • Why do you log so many infos? Have you thought about just logging warnings and errors? Sure a 'journal' holding information on 'who did what' sounds good in general, but who will ever parse that mach information at all? – Stefan Sep 28 '15 at 22:43
  • @stefan it's one line per request. I'm serving about 100-200 request per second continuously. The access log contains information about rest calls made to the service. My options are to either disable it or find some way to compress. I'm not sure how to only show 404 requests. – user3258271 Sep 29 '15 at 02:00
  • Why not using a system component for this? E.g.: http://linuxcommand.org/man_pages/logrotate8.html – daniel.eichten Sep 29 '15 at 08:01
  • we use logrotate for the syslogs (among others) for the servers, but access.log is controlled by tomcat, which is already rotating it. Can i still control it with logrotate as well? I really just need to compress the log files that are older than today. – user3258271 Sep 29 '15 at 14:03
  • You can disable the access log, by editing tomcatdir/server.xml and delete or comment the access log valve. – Stefan Sep 30 '15 at 06:39
  • thanks. spring-boot provides some properties i can set to turn off the access log. id very much like to keep it if possible. it really just needs to be compressed after it rotates. – user3258271 Sep 30 '15 at 17:20

0 Answers0