Lucene Search Syntax Guide
Lucene Search Syntax Guide
Disclaimer
The information contained in this document is subject to change without notice. LogRhythm, Inc. makes no
warranty of any kind with respect to this information. LogRhythm, Inc. specifically disclaims the implied
warranty of merchantability and fitness for a particular purpose. LogRhythm, Inc. shall not be liable for any
direct, indirect, incidental, consequential, or other damages alleged in connection with the furnishing or use
of this information.
Trademark
LogRhythm is a registered trademark of LogRhythm, Inc. All other company or product names mentioned
may be trademarks, registered trademarks, or service marks of their respective holders.
LogRhythm Inc.
4780 Pearl East Circle
Boulder, CO 80301
(303) 413-8745
www.logrhythm.com
Complex Queries 3
Boolean Operators 3
Grouping 5
Field Grouping 5
Troubleshooting 5
Classification 9
Host 10
Identity 11
Location 12
Log 13
Network 14
Basic Queries
Type a query using the following basic syntax of field, colon, standard open quotation mark, term, standard
end quotation mark: Metadata:"term"
The Metadata used in the Web Console are details from log messages. For complete information on the
metadata available, including the syntax, a description, and the corresponding Web Console display name,
see the tables at the end of this document.
Example
If you wanted to run a query for all activity that falls under the Malware classification, you would
use: classificationName:"Malware"
If you wanted to run a query for the impacted user account jon.smith, you would use:
login:"jon.smith"
Lucene search looks for exact matches in the Metadata name. You must be careful to match capitalization
correctly. The term, however, is not case sensitive. If you tried either of these, the Web Console widgets
would return No data available error messages.
classificationname:"Malware"
Login:"jon.smith"
To escape a special character that is part of the query syntax, use a backslash before the character.
Characters that require this treatment are: + - && || ! ( ) { } [ ] ^ " ~ * ? : \
Example
If you wanted to run a query for an impacted user whose name is jon*, you would use: login:"jon\*"
If you wanted to run a query for an impacted user whose name is jon.smith-miller, you would use:
login:"jon.smith\-miller"
You can use a period and question mark combination (.?) for single-character wildcards.
Example
If you wanted to run a query for an impacted user named either Jon or Jan, you would use: login:/J.?n/
Example
If you wanted to run a query for all impacted users whose name begins with Jo, you would use:
login:/Jo.*/
If you wanted to run a query for all impacted users whose account ends with Smith, you would use:
login:/.*Smith/
If you wanted to search for all classifications containing the word Malware, you would use:
classificationName:/.*Malware.*/
You can also use wildcard queries to filter results by blank or non-blank term fields.
Example
If you wanted to run a query for all log messages classified under any major activity group, you
would use: classificationName:/.*/
If you wanted to run a query for all log messages NOT classified under any major activity group,
you would use: *:* AND NOT classificationName:/.*/
To use a fuzzy match to locate terms similar to what you type, use a tilde (~) with no quotations marks or
slashes.
Example
If you wanted to run a query for impacted users whose names are similar to Jon, such as Ron or John,
you would use: login:Jon~
Example
If you wanted to run a query for all activity that falls under the Malware classification or that originated
from a particular host, you would use any of the following:
The AND operator looks for all terms to exist. You can also use && in place of AND.
Example
If you wanted to run a query to see whether Malware activity originated from a particular host, you would
use either of the following:
The NOT operator excludes results with that term. You can also use ! in place of NOT.
Example
If you wanted to run a query for the impacted user account jon.smith for all activity that is not classified as
Malware, you would use either of the following:
If you need to run a NOT search by itself, use the following wildcard syntax:
To search by a range, include TO between the parameters. To run an inclusive search, use square brackets [
]. To run an exclusive search, use curly brackets { }.
To run a search on a log date, you need to convert the time to epoch format in milliseconds. There are several
online tools to help you do so, including EpochConverter and Unix Time Stamp.
Example
If you wanted to run a query for all logs after October 30, 2016 at 9 A.M. local time, you would use:
normalDate{1477839600000 TO *}
Example
If you wanted to run a query for all activity that falls under the Malware or Attack classifications, you
would use: classificationName:("Malware" "Attack")
Field Grouping
Use parentheses to group fields in order to create combinations of any of these query types.
Example
If you wanted to run a query for the host from which Malware activity originated, exclusive of the
first and last IP addresses in two different ranges, you would use:
originHost: ({106.194.190.210 TO 106.194.190.250} OR {106.194.190.365 TO 106.194.190.395})
AND classificationName:"Malware"
If you wanted to run a query to look for Malware or Compromise activity that impacted any of three
separate users but that does not come from a particular IP address, you would use: login:
("jon.smith" "fred.miller" "janice.jones") AND classificationName:("Malware" "Compromise")
AND NOT originHost:"106.194.190.210"
Troubleshooting
If your Lucene query returns a No data available error or otherwise is not returning the results you expect,
check the following:
Upper and lower case accuracy of the metadata field and the term
Use of quotation marks, forward slashes, and/or back slashes
Use of wild card characters
Capitalization of Boolean logic terms
Use of parentheses in complex queries
Applications
Web
Console Lucene Search
Field Description
Display Syntax
Name
Command command The name of an executed command within the metadata (for
example: login, get, or put).
Hash hash The digital signature, or mathematical equivalent, of the file that
retrieves data from a URL or is the combination of other
downloaded files.
Object objectType A pair with an Object and an Object Name for example, the
Type content type from HTTP logs.
Process process Name or value that identifies a process (for example, "inetd" or
Name "sshd").
Size size The size of an item, which depends on the log type. For example,
logs relating to firewalls may show the size or length of a packet.
Subject subject Email subject line. For non-email logs, this field could represent
the subject in some form of communicated information.
Version version A value that represents a version (OS version, patch version, doc
version, etc.).
MPE Rule mpeRuleName Message Processing Engine (MPE) rule, which identifies
Name and normalizes log messages and then assigns them to a
Log Type (Common Event).
Policy policy The LogRhythm Policy (e.g., FIM, RIM, Agent, etc.)
resulting in the log being generated.
Reason reason The reason code within a log message. For example:
Checkpoint: reason=mlx Syslog - AirTight IDS/IPS:
REASON=1
Response Code responseCode The response code that is returned from a prior command.
Status status The current waiting state for a process, system state,
network state, or attempted action.
Threat Name threatName The name of a specific threat as defined from a third party
security system or device, such as a firewall, IPS/IDS, AV,
Endpoint Protection System, etc.
Vendor Info vendorInfo Human readable strings that may contain clarifying
information not easily encapsulated by CE/Classification or
a rule name.
Host
Web Console Lucene Search
Field Description
Display Name Syntax
Host (Impacted) impactedHost The host involved in the log activity, which may include the
IP address, host name, or Ethernet address:
Host (Origin) originHost
l Host (Impacted) is the destination.
l Host (Origin) is the source.
Hostname impactedName The name of the host involved in the log activity (for
(Impacted) example, a DNS name or a Netbios name):
Hostname originName l Hostname (Impacted) is the destination.
(Origin) l Hostname (Origin) is the source.
Known Host impactedHostName The host record associated with a specific Entity:
(Impacted)
l Known Host (Origin) is the source of the log activity.
Known Host originHostName l Known Host (Impacted) is the destination of the log
(Origin) activity.
Mac Address impactedMac The MAC address involved in the log message:
(Impacted)
l MAC Address (Origin) is the source.
Mac Address originMac l MAC Address (Impacted) is the destination.
(Origin)
NAT IP Address impactedNatIp The IP address that was translated via NAT device logs:
(Impacted)
l NAT IP Address (Origin) is the source.
NAT IP Address originNatIp l NAT IP Address (Impacted) is the destination.
(Origin)
Serial Number serialNumber This is the serial number for a specific device or system.
Identity
Web
Lucene
Console
Search Field Description
Display
Syntax
Name
Group group User group or role referenced or impacted by the log activity. This group is
typically an Active Directory group name or other type of logical
container.
Recipient recipient Email address or VOIP caller number. For non-email logs, this field could
represent the user who received a form of information.
Sender sender Email originator or VOIP caller number. For non-email logs, this field
could represent the user who received a form of information.
User login The user logon that is the source of the log activity.
(Origin)
User account The user account that is the recipient of the action (for example, a
(Impacted) password reset on a user account).
Entity (Impacted) impactedEntityName The resolved host entities involved in the log data:
Entity (Origin) originEntityName l Entity (Impacted) is the destination host.
l Entity (Origin) is the source host.
Root Entity rootEntityId The root entity (top-most entity) for a log source.
Zone (Impacted) impactedZoneName The resolved zone (Internal, External, or DMZ) that
LogRhythm identified in the log activity:
Zone (Origin) originZoneName
l Zone (Origin) is the source zone.
l Zone (Impacted) is the destination zone.
Log
Web Console Lucene Search
Field Description
Display Name Syntax
First Log Date normalMsgDate First occurrence of a single log in an aggregated log.
Last Log Date normalDateMax Latest occurrence of a single log in an aggregated log.
Log Date normalDate The creation date contained in the log. This value can be
in UTC or a user-selected time zone.
Log Message logMessage Text from the log that is parsed into metadata fields.
Log Source logSourceName A unique identifier that generated the log on a specific
host.
Log Source Entity entityName A logical collection of unique networks, devices, and
systems.
Log Source Host logSourceHostName The system or device where the Log Source originated.
Log Source Type logSourceTypeName Type of facility or source where the log originated.
Log Sequence sequenceNumber The order in which the log was collected, in relation to
Number other logs.
Network
Web
Console Lucene Search
Field Description
Display Syntax
Name
NAT impactedNatPort The TCP/UDP port that was translated via NAT device logs:
TCP/UDP
l NAT TCP/UDP Port (Origin) is the source.
Port
originNatPort NAT TCP/UDP Port (Impacted) is the destination.
(Impacted) l
NAT
TCP/UDP
Port
(Origin)
Session sessionType If a session code is already in use for TCP or UDP protocols, this
Type field is used for a session type that could be ssh, console, etc. Upon
the establishment of a network connection, a session type is defined
for that connection.
User userAgent A unique string which identifies the browser or application and
Agent provides system specific details to servers hosting visited websites.