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.
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)- A93% (52)
- B4% (2)
- C2% (1)
- D2% (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.
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.
Option B omits the required 'like' keyword; 'where (field, pattern)' is not valid Splunk SPL syntax and will not perform pattern matching.
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.
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
Community Discussion
No community discussion yet for this question.