Handy Dandy Tool for parsing Solr logs

Have you ever had to look at the Solr logs for potential issues? It’s not a fun task and the Solr logging UI doesn’t exactly make it easy. In fact, it’s easier to crack open the logs using your favorite text editor. But even that can be challenging.

I’m sure there are plenty of tools out there to help make this task easier like Splunk but what if you don’t have Splunk? I found this handy dandy tool to be pretty quick and useful for parsing Solr logs when troubleshooting issues.

To get started parsing your logs:

  1. Simply Download and unzip.
  2. Run the following command java -jar slr.jar [solr log dir] 
  3. As it runs it will output summary info to the console.
  4. If you prefer a more verbose output you can specify an output directory, for example, java -jar slr.jar [solr log dir] -o [output dir]
  5. Contained in the output directory and you’ll find the following:
  • core-logging.txt
  • logs-report.txt
  • query-report.txt
  • unique-error-report.txt
  • error-chart.html

Optional parameters

  • -o – if you specify an output directory, more verbose summaries are dumped to files in that folder as well as an html error chart.
  • -r – allows you to filter processed log entries by timestamp range using the format yyyy-MM-dd HH:mm:ss.
  • TextMatchAspect – will pull out any logs with matching text and you can specify as many as you want. You must specify an output directory. java -jar slr.jar [solr logs dir] {some text to match} -o [output dir]

Configuring Solr Logs

The Solr logs can provide useful information to help diagnose issues. However, you might need to configure the log level if the information being logged is not adequate. This can be done easily through the Admin UI by selecting the Logging tab and then Level. You can set the level for different categories:

  • Finest – reports everything
  • Fine – reports everything but the least important messages.
  • Config – reports configuration errors.
  • Info – reports everything but normal status.
  • Warn – reports all warnings.
  • Severe – reports only the most severe warnings.
  • Off – turns off logging.
  • Unset – removes the previous log setting.

Setting the log level via the Admin UI is only temporary once you restart Solr you’ll need to re-configure it. However, if you want to set the logging level permanently then you can modify the log4j.properties file located in the [solr install directory]/server/resources.

You should also consider changing MaxFileSize for RollingFileAppender has a default value of 4MB. This is probably too low for most production environments you’ll want to change this to at least 50-100MB. The MaxBackupIndex which is defaulted to 9 meaning Solr will maintain a history of 9 log files. So ensure you have enough storage capacity in your log directory location.

Additional info

Happy parsing!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s