Filtering and Formatting Results Flashcards

1
Q

What does the |eval command do?

A

Eval calculates an expression, then puts the resulting value into a new or existing field.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens when using the |eval command with a field that already exists?

A

Eval will overwrite the values of the field with the results of the eval expression.

This is done at search time and does NOT change or overwrite any of the already indexed data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens when using the |eval command to create a new field?

A

Eval will take the values of the expressions, but still no new data is written to the index since the eval command happens at search time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What operator does the |eval command support?

A
  • Arithmetic (+ - * / %)
  • Concatenation (+ .)
  • Boolean (AND OR NOT XOR)
  • Comparison (< > <= >= != = LIKE)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True or False: Using the |eval command, field values are treated in a case-sensitive manner.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Using the |eval command, string values must be [blank]

A

Double-quoted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Using the |eval command, field names must be [blank] when they include a special character like a space

A

Unquoted or single quoted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Using the |eval command, when should you use a period (.) to concatenate?

A

When concatenating strings and numbers.

Ex.
|eval Sales = “$”.tostring(Sales, “commas”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the mutiple ways to write |eval expressions

A
  • Separate pipeline segments
  • Nested
  • Linked with a comma
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Fields created by the |eval command are [blank]

A

Temporary (not indexed) but are searchable and treated like any other field.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which commands can most evaluation functions be used with?

A
  • |eval
  • |where
  • |fieldformat
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the if() function of the |eval command do?

A

The if() function evaluates expression X. If it evaluates to TRUE, returns Y. Otherwise, returns Z.

Ex.
eval animal = if(pet=”cat”, “cat”, “non-cat”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the case() function of the |eval command do?

A

The case() functions allows you to enter multiple boolean expressions separated by the argument of what to return if the previous expressions evaluates to true.

Ex.
eval animal = case(pet=”cat”, “Kitten”, pet=”dog”, “Doggy”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The case() function of the |eval command useful for what?

A

Data normalization.

Ex.
|eval location = case(location=”BOS’ OR location = “Boston”, Boston”, location=”LDN” OR location=”London”, “London”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happens if none of the expressions in a case() function return true?

A

An empty field will be returned.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the validate() function of the |eval command do?

A

validate() works like the case() function, except instead of evaluating whether or not a statement is true, it returns an argument when an expression is false.

17
Q

What does the in() function of the |eval command do?

A

in() allows you to evaluate a value from a field against a list of possible values.

Ex.
|eval error = if(in(status, “404”,”500”,”503”), “true”,”false”)

18
Q

When can the in() function be used with the |eval command?

A

in() must be used within the if or case functions with eval.

19
Q

What does the searchmatch() function of the |eval command do?

A

searchmatch() will return a value of true (Y) or false (Z) whether an event matches the search string passed in (X)

Ex.
|eval matchResult = if(searchmatch(“Got A Case of the Mondays”), “found”, “not found”)

20
Q

What is the syntax of the searchmatch() function?

A

|eval <field> = if(searchmatch(X), Y, Z)</field>

21
Q

When can the searchmatch() function be used with the |eval command

A

searchmatch() must be used within the if() function or case() function with the |eval command

22
Q

What does the cidrmatch() function of the |eval command do?

A

cidrmatch() returns True/False based on whether provided IP address Y matches subnet specified by X

Ex.
|eval isLocal = if(cidrmatch(“10.2/16”, clientip), “IS local”, “NOT local”)

23
Q

What does the match() function of the |eval command do?

A

match() returns True/False based on whether (SUBJECT) matches the RegEx pattern.

Ex.
|eval matchResult = if(match(_raw, “Got a Case of the Mondays”), “found”, “not found”)

24
Q

What does the replace() function of the |eval command do?

A

replace() returns a string by substituting Z for every occurrence of Y in X.

Ex.
|eval AcctCode = replace(AcctCode, “\d{4}-)\d{4}”, “\1xxxx”)

25
Q

What is the replace() function of the |eval command useful for?

A

Useful for masking data such as account numbers and IP addresses

26
Q

What does the |fillnull command do?

A

|fillnull replaces null values in fields. You can specify what to replace a null value with using value=<string>. If not specified, defaults to value=0.</string>

27
Q

What is the syntax of the |fillnull command?

A

|fillnull [value=<string>] [<field-list>]</field-list></string>

28
Q

What does the |where command do?

A

|where acts as a filter on search results by removing results that do not match the <eval-expression></eval-expression>

29
Q

How is the |where command different from the |search command?

A

|where allows for field on field comparison.

Ex.
|where removals > changes

30
Q

How can you use the |where command to force case-sensitive searches?

A

Ex.
index=sales sourcetype=vendor_sales VendorCountry=”United States”
|where categoryId=”STRATEGY”

31
Q

What does the |where command have that the |search command does not?

A

The |where command has its own wildcards that are separate from the one used with the search command (*).

  • Operator: |where <string> LIKE <pattern></pattern></string>
  • Function: |where like (<string>, <pattern>)</pattern></string>
  • % for multiple characters
  • _ for single character