where - Splunk Documentation (2024)

Description

The where command uses eval-expressions to filter search results. These eval-expressions must be Boolean expressions, where the expression returns either true or false. The where command returns only the results for which the eval expression returns true.

Syntax

where <eval-expression>

Required arguments

eval-expression
Syntax: <eval-mathematical-expression> | <eval-concatenate-expression> | <eval-comparison-expression> | <eval-boolean-expression> | <eval-function-call>
Description: A combination of values, variables, operators, and functions that represent the value of your destination field. See Usage.
The <eval-expression> is case-sensitive. The syntax of the eval expression is checked before running the search, and an exception is thrown for an invalid expression.
The following table describes characteristics of eval expressions that require special handling.
Expression characteristicsDescriptionExample
Field names starting with numeric charactersIf the expression references a field name that starts with a numeric character, the field name must be surrounded by single quotation marks.'5minutes'="late"


This expression is a field name equal to a string value. Because the field starts with a numeric it must be enclosed in single quotations. Because the value is a string, it must be enclosed in double quotations.

Field names with non-alphanumeric charactersIf the expression references a field name that contains non-alphanumeric characters, the field name must be surrounded by single quotation marks.new=count+'server-1'


This expression could be interpreted as a mathematical equation, where the dash is interpreted as a minus sign. To avoid this, you must enclose the field name server-1 in single quotation marks.

Literal stringsIf the expression references a literal string, the literal string must be surrounded by double quotation marks.new="server-"+count


There are two issues with this example. First, server- could be interpreted as a field name or as part of a mathematical equation, that uses a minus sign and a plus sign. To ensure that server- is interpreted as a literal string, enclose the string in double quotation marks.

Usage

The where command is a distributable streaming command. See Command types.

The <eval-expression> is case-sensitive.

The where command uses the same expression syntax as the eval command. Also, both commands interpret quoted strings as literals. If the string is not quoted, it is treated as a field name. Because of this, you can use the where command to compare two different fields, which you cannot use the search command to do.

CommandExampleDescription
Where

... | where ipaddress=clientip

This search looks for events where the field ipaddress is equal to the field clientip.
Search

| search host=www2

This search looks for events where the field host contains the string value www2.
Where

... | where host="www2"

This search looks for events where the value in the field host is the string value www2.

Boolean expressions

The order in which Boolean expressions are evaluated with the where command is:

  1. Expressions within parentheses
  2. NOT clauses
  3. AND clauses
  4. OR clauses

This evaluation order is different than the order used with the search command. The search command evaluates OR clauses before AND clauses.

Using a wildcard with the where command

You can only specify a wildcard by using the like function with the where command. The percent (% ) symbol is the wildcard that you use with the like function. See the like() evaluation function.

Supported functions

You can use a wide range of evaluation functions with the where command. For general information about using functions, see Evaluation functions.

  • For a list of functions by category, see Function list by category.
  • For an alphabetical list of functions, see Alphabetical list of functions.

Examples

1. Specify a wildcard with the where command

You can only specify a wildcard with the where command by using the like function. The percent (% ) symbol is the wildcard you must use with the like function. The where command returns like=TRUE if the ipaddress field starts with the value 198..

... | where like(ipaddress, "198.%")

2. Match IP addresses or a subnet using the where command

Return "CheckPoint" events that match the IP or is in the specified subnet.

host="CheckPoint" | where like(src, "10.9.165.%") OR cidrmatch("10.9.165.0/25", dst)

3. Specify a calculation in the where command expression

Return "physicsjobs" events with a speed is greater than 100.

sourcetype=physicsjobs | where distance/time > 100

See also

eval, search, regex

Last modified on 25 January, 2023

walklexx11

This documentation applies to the following versions of Splunk® Enterprise: 7.0.0, 7.0.2, 7.0.3, 7.0.4, 7.0.5, 7.0.6, 7.0.7, 7.0.8, 7.0.9, 7.0.10, 7.0.11, 7.0.13, 7.1.0, 7.1.1, 7.1.2, 7.1.3, 7.1.4, 7.1.5, 7.1.6, 7.1.7, 7.1.8, 7.1.9, 7.1.10, 7.2.0, 7.2.1, 7.2.2, 7.2.4, 7.2.5, 7.2.6, 7.2.7, 7.2.8, 7.2.9, 7.2.10, 7.3.0, 7.3.1, 7.3.2, 7.3.3, 7.3.4, 7.3.5, 7.3.6, 7.3.7, 7.3.8, 7.3.9, 8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.0.5, 8.0.6, 8.0.10, 8.1.0, 7.2.3, 8.0.8, 7.0.1, 8.0.7, 8.1.2, 8.1.3, 8.1.4, 8.1.5, 8.1.6, 8.1.7, 8.1.8, 8.1.9, 8.1.11, 8.1.12, 8.1.13, 8.1.14, 8.2.0, 8.2.1, 8.2.2, 8.2.3, 8.2.4, 8.2.5, 8.2.6, 8.2.7, 8.2.8, 8.2.9, 8.2.10, 8.2.11, 8.2.12, 9.0.0, 9.0.1, 9.0.2, 9.0.3, 9.0.4, 9.0.5, 9.0.6, 9.0.7, 9.0.8, 9.0.9, 9.0.10, 9.1.0, 9.1.1, 9.1.2, 9.1.3, 9.1.4, 9.1.5, 9.2.0, 9.2.1, 9.2.2, 8.0.9, 8.1.1, 8.1.10

where - Splunk Documentation (2024)
Top Articles
BEST Red Velvet Cake Recipe - Handle the Heat
Maple Balsamic Vinaigrette Recipe
7500 Oz Of Gold Worth
AT&T Wireless Internet (IFWA40) - Check the Wireless Signal - AT&T
Juicymagik
Declan Mining Co Coupon
Jd Parker And Sons Pay Bill Online
Joyride Auction Indianapolis
Adventhealth Centra Care Horizon West Reviews
Could Mitt Romney, Jeff Flake serve in Harris’ Cabinet?
Cabelas Bolingbrook
Georgia wins College Football National Championship: Live updates | CNN
Access One Ummc
Solar Shower Walmart
Foodsmart Jonesboro Ar Weekly Ad
Lmu Academic Calendar Spring 2023
Safety Jackpot Login
Teacup Yorkies For Sale In Ohio Under $500
Craigslist Longview Wa Cars
Best Places To Eat In Winter Park Fl
Blippi Park Carlsbad
Wellness Road Massage - Louisville, KY 40217 - Services and Reviews
Geese For Sale On Craigslist Near Me
Entry requirements - Iran travel advice
Ukc Message Board
New support for semiconductor firms to grow, powering growth in £10 billion UK industry
Brian Niccol Net Worth
Baptist Primary Care Murabella
Justwingit Facial
Golden Sands
Utexas Iot Wifi
Social Security Office Carlsbad
Craigslist Santa Barbara Free
Erin Burnett Without Makeup
Prey For The Devil Showtimes Near Phoenix Theatres Kennedy Mall
Breakroom Bw
Uwsp Calendar 22-23
Www Craigslist Antelope Valley
Jxrmme Leaked
3472542504
Cbx Promo Codes 2023
S-w-m.de [WHOIS Lookup]
1627770 Classic Blue
Watch Rick And Morty Season 6 Online Free 123
What Does Exp Wed Mean On Hulu
Guest Advocate (Cashier or Front of Store Attendant/Cart Attendant) (T0245) at Target | The Muse
7Days To Die Crucible
Morris Funeral Home Sebring Florida
Credit Cards - Apply for a New Credit Card Online
Obituary for Bill Boyd at Lovein Funeral Home, Inc.
9Anime.tol
Unique taste. Crunchy like no other.
Latest Posts
Article information

Author: Roderick King

Last Updated:

Views: 5491

Rating: 4 / 5 (51 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Roderick King

Birthday: 1997-10-09

Address: 3782 Madge Knoll, East Dudley, MA 63913

Phone: +2521695290067

Job: Customer Sales Coordinator

Hobby: Gunsmithing, Embroidery, Parkour, Kitesurfing, Rock climbing, Sand art, Beekeeping

Introduction: My name is Roderick King, I am a cute, splendid, excited, perfect, gentle, funny, vivacious person who loves writing and wants to share my knowledge and understanding with you.