nerdexam
Splunk

SPLK-1002 · Question #159

Which of the following searches will return all clientip addresses that start with 108?

The correct answer is A. ... | where like (clientip, "108.% ). The Splunk 'where like()' function uses SQL-style wildcard pattern matching with '%' to filter field values by a specified prefix or pattern.

Filtering and Grouping Results

Question

Which of the following searches will return all clientip addresses that start with 108?

Options

  • A... | where like (clientip, "108.% )
  • B... | where (clientip, "108. %")
  • C... | where (clientip=108. % )
  • D... | search clientip=108

How the community answered

(56 responses)
  • A
    93% (52)
  • B
    4% (2)
  • C
    2% (1)
  • D
    2% (1)

Why each option

The Splunk 'where like()' function uses SQL-style wildcard pattern matching with '%' to filter field values by a specified prefix or pattern.

A... | where like (clientip, "108.% )Correct

The 'where like(field, pattern)' syntax applies pattern matching where '%' acts as a wildcard for zero or more characters. Using 'like(clientip, "108.%")' correctly matches all clientip values beginning with '108.', returning every IP address in that range regardless of what follows.

B... | where (clientip, "108. %")

Option B omits the required 'like' keyword; 'where (field, pattern)' is not valid Splunk SPL syntax and will not perform pattern matching.

C... | where (clientip=108. % )

Option C uses an unquoted assignment-style expression without the 'like' function, which is not valid SPL syntax for the where command and will not produce wildcard matching.

D... | search clientip=108

Using 'search clientip=108' performs a literal string match on the value '108' only; it would not match addresses like '108.1.2.3' that start with but extend beyond that exact string.

Concept tested: Splunk where like() wildcard prefix matching on field values

Source: https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Where

Topics

#filtering data#where command#like function#string pattern matching

Community Discussion

No community discussion yet for this question.

Full SPLK-1002 Practice