Solr 5.1: Solr creates too many log files

I am dealing with a problem where Solr 5.1 creates too many log files. Every time Solr restarts and periodically throughout the week, Solr creates the following files, and I need to stop it:

  • Files of type solr_gc_xxxxxxxx_xxxx, where x represents the date and some identification number, respectively. They contain garbage collection information.
  • Files of type solr_log_xxxxxxxx_xxxx, where x represents the date and some identification number, respectively. They contain the same information that you find in the solr.log file.
  • One file of type solr- [port] -console.log. It always contains only the following text: WARNING: System properties and/or JVM args set. Consider using --dry-run or --exec WARNING: System properties and/or JVM args set. Consider using --dry-run or --exec

A week later, I collected almost thirty files of type 1 and 2!

Even worse, file types 1 and 2 do not seem to match my log4j.rootlogger setting and are populated with INFO level stuff.

Here are the relevant parts of my log4j.properties file:

 # Logging level solr.log=logs log4j.rootLogger=WARN, file #- size rotation with log cleanup. log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.MaxFileSize=100MB log4j.appender.file.File=${solr.log}/solr.log log4j.appender.file.MaxBackupIndex=0 

I want to do the following:

  • Create only the solr.log file + one backup file. solr.log should be periodically rewritten.
  • Do not create any other log file.

What can I do for this?

+5
source share
1 answer

So, after some time, I figured out how to fix it.

To repeat, Solr went on to create a whole bunch of files with the solr_log * and gc_log * templates at startup and periodically throughout the day. In the end, I had rather serious space problems due to the endless number of magazines that Solr likes to create.

Go to /path/to/solr/bin and find the solr script that starts when it starts. Open the file, find the following and comment out mv "$SOLR_LOGS_DIR/solr.log" "$SOLR_LOGS_DIR/solr_log_$(date +"%Y%m%d_%H%M")" :

 # backup the log files before starting if [ -f "$SOLR_LOGS_DIR/solr.log" ]; then if $verbose ; then echo "Backing up $SOLR_LOGS_DIR/solr.log" fi mv "$SOLR_LOGS_DIR/solr.log" "$SOLR_LOGS_DIR/solr_log_$(date +"%Y%m%d_%H%M")" fi 

Or delete it if you want. You can also try not to use the -f flag, but here in my store we like it.

This will save solr.log , but Solr will no longer make backups. If you want a daily backup, I recommend TimeBasedRollingPolicy up TimeBasedRollingPolicy or, even better, DailyRollingFileAppender in the log4j.properties file, which can be found in /path/to/solr/server/resources .

If you want, you can also comment on the mv line for Solr's garbage collection logs, which will leave you only with solr_gc.log .

If, like mine, you have other ways to control gc for Solr, you need to completely disable gc logging.

In the same directory as the solr script, open solr.in.sh (Mac / Linux only, I think solr.cmd for Windows users) and comment on this line: # Enable verbose GC logging GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \ -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime" .

You will need to restart Solr.

+7
source

All Articles