Search Log Files

This Solution describes how to search your logs for a word, phrase, or regular expression, and how to search logs from a specific time period.

A Solution is a step-by-step guide for accomplishing a specific task, designed to make sense even if you're just getting started with Scalyr server monitoring. If you're new to Scalyr, you should read the short Getting Started guide. For help with other tasks, see the Solutions directory.

Prerequisites

1. The Scalyr Agent should be installed on the server(s) you want to monitor, and should be configured to upload the log file(s) you want to search.

To verify:

  • In the navigation bar, click Overview.
  • Find each server in the list at the bottom of the page.
  • Verify that each log file is listed next to the appropriate server.

If any server is not listed:

If any log file is not listed:

Steps

1. Open the log(s) to search.

  • To search all logs, simply click Search in the navigation bar.
  • To search a particular log, click Overview, and click the link for the desired log file from the desired server.

2. To search for a word, such as "warning", you can simply type it in the Expression box:

warning

To search for a phrase, enclose it in quotes:

"deadline exceeded"

To search for a regular expression, place a $ before the quotes:

$"/images/.*\.png"

Then click the Search button to search.

If, in step 1, you opened a specific log, the Expression box will contain some search terms selecting that log. Add your search term either before or after:

"deadline exceeded" ($logfile='/var/log/tomcat6/accesslog') $serverHost='your-server-name'

3. To search logs from a specific time period, edit the Start and End boxes of the search form, and click the Search button to search. You can use a variety of date and/or time formats. See the Time Range reference for details.

Further Reading

For additional search options, see Query Language. To read more about the log viewer, see Exploring Data.