Search code examples
javaloggingwso2wso2-bam

WSO2 BAM Log Files Size Large


I'm running wso2bam-2.4.1 in an Ubuntu instance. Below is the log folder structure. As you can see wso2carbon.log.2015-03-02 is 22GB.

-rw-r--r-- 1 root root    0 Feb  6 10:54 wso2carbon-trace-messages.log
-rw-r--r-- 1 root root    0 Feb  6 10:54 tm.out
-rw-r--r-- 1 root root    0 Feb  6 10:54 audit.log
-rw-r--r-- 1 root root    0 Feb  6 10:55 http_access_2015-02-06.log
-rw-r--r-- 1 root root 809K Feb  6 23:59 wso2carbon.log.2015-02-06
-rw-r--r-- 1 root root 792K Feb  7 23:59 wso2carbon.log.2015-02-07
-rw-r--r-- 1 root root 792K Feb  8 23:59 wso2carbon.log.2015-02-08
-rw-r--r-- 1 root root    0 Feb  9 13:34 http_access_2015-02-09.log
-rw-r--r-- 1 root root  11M Feb  9 23:59 wso2carbon.log.2015-02-09
-rw-r--r-- 1 root root  21K Feb 10 10:03 patches.log
-rw-r--r-- 1 root root    0 Feb 10 10:03 http_access_2015-02-10.log
-rw-r--r-- 1 root root 923K Feb 10 23:59 wso2carbon.log.2015-02-10
-rw-r--r-- 1 root root 188K Feb 12 23:57 wso2carbon.log.2015-02-11
-rw-r--r-- 1 root root 188K Feb 13 23:57 wso2carbon.log.2015-02-12
-rw-r--r-- 1 root root 188K Feb 14 23:57 wso2carbon.log.2015-02-13
-rw-r--r-- 1 root root 188K Feb 15 23:57 wso2carbon.log.2015-02-14
-rw-r--r-- 1 root root 189K Feb 16 23:57 wso2carbon.log.2015-02-15
-rw-r--r-- 1 root root 187K Feb 17 23:57 wso2carbon.log.2015-02-16
-rw-r--r-- 1 root root 190K Feb 18 23:57 wso2carbon.log.2015-02-17
-rw-r--r-- 1 root root 187K Feb 19 23:57 wso2carbon.log.2015-02-18
-rw-r--r-- 1 root root 792K Feb 19 23:59 wso2carbon.log.2015-02-19
-rw-r--r-- 1 root root 186K Feb 21 23:57 wso2carbon.log.2015-02-20
-rw-r--r-- 1 root root 186K Feb 22 23:57 wso2carbon.log.2015-02-21
-rw-r--r-- 1 root root 186K Feb 23 23:57 wso2carbon.log.2015-02-22
-rw-r--r-- 1 root root 187K Feb 24 23:57 wso2carbon.log.2015-02-23
-rw-r--r-- 1 root root 192K Feb 25 23:57 wso2carbon.log.2015-02-24
-rw-r--r-- 1 root root 189K Feb 26 23:58 wso2carbon.log.2015-02-25
-rw-r--r-- 1 root root 792K Feb 26 23:59 wso2carbon.log.2015-02-26
-rw-r--r-- 1 root root 792K Feb 27 23:59 wso2carbon.log.2015-02-27
-rw-r--r-- 1 root root 792K Feb 28 23:59 wso2carbon.log.2015-02-28
-rw-r--r-- 1 root root 191K Mar  2 23:58 wso2carbon.log.2015-03-01
-rw-r--r-- 1 root root 518K Mar  3 15:56 wso2carbon.log.2015-03-03
-rw-r--r-- 1 root root  22G Mar  3 23:59 wso2carbon.log.2015-03-02
-rw-r--r-- 1 root root  20K Mar  4 08:38 wso2carbon.log

The problem is some of the log files are really big so that I have to upgrade the server disk space repeatedly. My Questions are

  • How can I compress the recent logs which are within three month?
  • How can I delete logs after 3 months?
  • What are the methods to fix this log size issue?

Please provide a guide if possible

Also refer to this question as well which is related to WSO2 ESB.

WSO2 ESB log is too big, how to set?


Solution

  • You can configure our log4j.properties files inside /repository/conf to either roll your file based on size or time period.

    To answer your second question you can use a Corn job or any schedular task to backup and delete the older log files. Hope this will help you to achieve your task.