Search syntax

Full explanation of Papertrail’s search query syntax.



If you’ve used Google search, you’re familiar with 95% of Papertrail’s search syntax. Type what you have, whether it’s an IP address, an error string, the name of a program or system, a user’s session, or fragments of any of those things.

From there, build up sets of what you do and don’t want to see. Here’s a few examples for the Ruby on Rails framework to give you an idea.

This came from our experience using Papertrail for our logs, from watching early users try different syntaxes, and most importantly, from seeing what we and others actually wanted to find. By far the most common type of search was a set of desired program names or message strings (important things) combined with a few exclusions (noise).

This Boolean syntax makes queries like that fast to compose and easy to read/update.

Check out Linking to logs to quickly integrate Papertrail searches into your app’s internal admin interface.

Example Searches

These 6 searches demonstrate most of the syntax. The sender name, component/file name, and message are all searchable:

"Accepted password" sudo
(www42 some.log) OR (nyc-db2 other.log)
(message-id postfix/smtpd) OR
10.1.2 -("TTL exceeded" OR "1 packet")

Searches can also be constrained by an attribute, so Papertrail considers only that field:

program:(production.log staging.log) '"action"=>"index"' -("count(*)" OR abc)

Quick Reference

While in the event viewer, choose Help > Search Tips to see these examples without leaving the viewer:




Here’s how to get the narrowest set of results as fast as possible.


Use attributes:

Papertrail supports 5 attributes: sender, program, message, severity, facility. All are used in key:value fashion. Here’s an example search which incorporates attribute constraints:

("something bad" program:ssh -noise) OR severity:error

Here’s another, which includes two valid program values. Messages matching either one are returned (OR):

program:(raid5tools ethtool)

Attributes and attribute-less constraints can be used together, as can negation.

facility and severity support matching multiple values, so this matches any facility value beginning with local:


As a result, they also support shorthand, like this. No need to type the full severity values:

severity:(crit emerg)

For more examples, see Papertrail’s attribute announcement.

Search Syntax

Papertrail supports combining terms and phrases using AND, OR, and exclusion operators, as well as order of operations (parentheses). The message text, program/sender name, and system name (as shown in Papertrail’s dashboard) are searched.


By default, terms in the same search are automatically ANDed. This search:

something somethingelse

is equivalent to this search:

something AND somethingelse


To match one or more of multiple terms, use the OR keyword. For example:

something OR somethingelse

Note: OR must be capitalized.


Enclose phrases in single- or double-quotes. For example:

something OR "something else"

Single- and double-quotes are interchangeable, as long as the same type of quote is used to start and end the same phrase. To search for a phrase which contains a quote, use the other type of quote. For example, to match this punctuation-filled phrase:


enclose it in single-quotes, like this:


Order of operations

To indicate order of operations for matching, use parentheses. For example:

something ("something else" OR "a third thing")

says to match either of the 2 terms inside the parentheses, then AND it with the term outside the parentheses.

Contrast that search with the same search without parentheses:

something "something else" OR "a third thing"

which is ambiguous about whether the OR applies to just the middle term, or to both of the first 2 terms. (Without parentheses, terms are matched left to right).

AND and OR can be freely used inside and outside of parentheses.

Exclusion (negation)

Prepend - to a term, quoted phrase, or parenthesized set. For example, to show all logs except a certain word or quoted phrase:

-"exclude this"

Exclude all matches in a parenthesized set:

something -("but not" OR "something else")

Exclusions can be used anywhere in a query. For example:

something -("but not" OR "something else") "but this too"

Case sensitivity

Searches are case insensitive. This query:

Completed in

is equivalent to this query:

completed in


Papertrail supports 5 attributes: sender, program, message, severity, and facility.

These attributes can be used nearly interchangeably with attribute-less operators. Negation and phrases work the same.

4 of the 5 attributes - all except message - can only have a single value per message, so AND is never relevant. Because of this, all attributes default to OR. program:(a b) means program:(a OR b).

Additionally, any of the attribute names host, source, or system function as an alias for sender.


Other than quotes, no special adaptations should be needed to use punctuation in a term or phrase. For example, to see all occurrences of IP addresses within to, use this query:


The periods are interpreted as part of the string. Other punctuation works the same way, and no adaptations or escaping is needed.

Similarly, the entire log message is considered for matching. The search:


will match lines containing any of these:


Time/Date Search

To search for a time or date, click the clock icon to the right of the search box and enter a time, date, or combination. The time or date can be in almost any format, and will be parsed and displayed in realtime. Here’s a screenshot:



When searching by time in the Web interface, the searched-for timestamp is interpreted in the timezone of the computer you’re accessing Papertrail from.

Also, Papertrail tracks the time when a log message was received and automatically converts it to your account timezone when displaying the message. Set an account timezone in your profile. Users can have different timezones within the same organization, so no one needs to perform mental timezone conversion.

Sender name and program name

While sender name and program name/filename can be used in searches, they aren’t part of the phrase that Papertrail matches against. For example, this log message:

www42 httpd: GET / HTTP/1.0

would be matched by any of these queries:

www42 GET
httpd GET
www42 httpd GET
www42 httpd "GET /"
www42 OR "GET /"

However, that message would not be matched by this phrase query because the program name and separating colon are not included in the phrase:

"httpd: GET"

Linking to Searches

This document has moved to Linking to logs.