SPLK-1001 · Question #77
Which search string returns a filed containing the number of matching events and names that field Event Count?
The correct answer is B. index=security failure | stats count as "Event Count". Option B is correct because stats count is the Splunk SPL command that counts the total number of matching events, and as "Event Count" renames that result field to "Event Count" - exactly what the question asks for. A is wrong because sum requires a numeric field to add up…
Question
Which search string returns a filed containing the number of matching events and names that field Event Count?
Options
- Aindex=security failure | stats sum as "Event Count"
- Bindex=security failure | stats count as "Event Count"
- Cindex=security failure | stats count by "Event Count"
- Dindex=security failure | stats dc(count) as "Event Count"
How the community answered
(43 responses)- A2% (1)
- B77% (33)
- C7% (3)
- D14% (6)
Explanation
Option B is correct because stats count is the Splunk SPL command that counts the total number of matching events, and as "Event Count" renames that result field to "Event Count" - exactly what the question asks for.
- A is wrong because
sumrequires a numeric field to add up values across events; it doesn't count events themselves, and omitting the field argument tosumwould cause an error. - C is wrong because
count by "Event Count"attempts to group results by a field named "Event Count," which doesn't exist -byspecifies a grouping field, not a field name to assign. - D is wrong because
dc(count)means "distinct count of the field namedcount," which is a different function (deduplication count) and references a nonexistent field calledcount.
Memory tip: Think of the pattern as stats count as "YourFieldName" - count tallies events, as renames. If you see by, it's grouping; if you see dc(), it's distinct count of a specific field - not a total event count.
Community Discussion
No community discussion yet for this question.