# Free SPLK-1002 practice questions

> 10 free SPLK-1002 practice questions with the correct answer and an explanation.

Page: https://devopscodelab.com/exams/splunk-splk-1002/free-practice-questions/
Practice exams: https://devopscodelab.com/exams/splunk-splk-1002/

### Question 1 of 10

An analyst needs a line chart that shows the number of web errors per hour over the last 24 hours, with one line for each value of the host field. Which search produces results in the correct shape for that visualization?

- A. index=web status>=500 | timechart span=1h count by host
- B. index=web status>=500 | top limit=24 host by date_hour
- C. index=web status>=500 | bin _time span=1h | stats count by host, _time
- D. index=web status>=500 | chart count over host span=1h

**Answer:** A

**Explanation:** timechart buckets _time into the given span and splits the count into one column per host, which is exactly the series layout a line chart needs. bin plus stats counts the same buckets but returns one row per host and hour instead of one column per host, so the chart cannot draw a line per host without further reshaping. chart over host puts host on the x-axis instead of time, and top returns the most common values with percentages rather than a time series.

### Question 2 of 10

An eval must set a field named severity to high when status is 500 or greater, medium when status is between 400 and 499, and low for everything else. Which expression is correct?

- A. | eval severity=case(status>=500,"high",status>=400,"medium",true(),"low")
- B. | eval severity=coalesce(status>=500,"high",status>=400,"medium")
- C. | eval severity=if(status>=500,"high",status>=400,"medium","low")
- D. | eval severity=case(status>=400,"medium",status>=500,"high",1=1,"low",status<400,"low")

**Answer:** A

**Explanation:** case() evaluates condition/value pairs in order and returns the first match, and true() as the last condition provides the default. if() accepts exactly three arguments, so the five-argument form is invalid. Putting status>=400 first (even with extra fallback pairs) means a 503 matches medium before the high test is reached, and coalesce() returns the first non-null argument rather than testing conditions.

### Question 3 of 10

A login workflow writes an event containing "login attempt" and later an event containing "login success". The analyst wants transactions that begin with the attempt and finish with the success for the same user. Which search is correct?

- A. | transaction user maxevents=2 keeporphans=true
- B. | transaction startswith=user endswith="login success"
- C. | transaction user startswith="login attempt" endswith="login success"
- D. | stats earliest("login attempt") latest("login success") by user

**Answer:** C

**Explanation:** startswith and endswith accept search terms or eval expressions that define the first and last event of each transaction, and grouping by user keeps different users apart. maxevents=2 with keeporphans only caps size and keeps unmatched events, so it never checks the event content. startswith=user uses the literal text user instead of the field, and earliest()/latest() take field names, not search strings.

### Question 4 of 10

A user wants to extract a field from events that have no consistent delimiter but follow a recognizable text pattern. In the Field Extractor, which method should be chosen?

- A. Regular Expression
- B. Lookup definition
- C. Delimiters
- D. Automatic key-value

**Answer:** A

**Explanation:** The Field Extractor offers two methods: Regular Expression for unstructured text with a pattern, and Delimiters for data separated by a character such as a comma or tab. Delimiters would not work when there is no consistent separator. Automatic key-value extraction is a search-time default, not a Field Extractor method, and lookups add fields from external tables rather than extracting them from events.

### Question 5 of 10

An analyst wants a calculated field that returns the value of user if present, otherwise the value of username, otherwise the string unknown. Which eval expression should the calculated field use?

- A. nullif(user, username, "unknown")
- B. if(isnull(user), username, "unknown")
- C. coalesce(user, username, "unknown")
- D. case(user, username, true(), "unknown")

**Answer:** C

**Explanation:** coalesce() returns the first argument that is not null, so it checks user, then username, then falls back to the literal unknown. The if() version returns unknown whenever user exists, which is backwards. case() expects boolean conditions, not field values, and nullif() compares two values and returns null when they are equal, taking only two arguments.

### Question 6 of 10

An event type named vpn_login uses the search sourcetype=vpn action=login. The team tags the event type with remote_access. Which search will return those events using the tag?

- A. eventtype=remote_access
- B. tag::sourcetype=remote_access
- C. tag=remote_access
- D. tag::action=remote_access

**Answer:** C

**Explanation:** Tags applied to an event type are attached to the eventtype=vpn_login field/value pair, so tag=remote_access (or tag::eventtype=remote_access) finds the events. eventtype=remote_access looks for an event type named remote_access, which does not exist. The tag was not applied to the sourcetype or action field values, so those field-specific tag searches return nothing.

### Question 7 of 10

A macro latency_over(1) takes an argument ms that must be a number. The team wants Splunk to reject invocations such as latency_over(abc) with a clear message. What should be configured on the macro?

- A. The Use eval-based definition option with the expression tonumber($ms$)
- B. Read-only permissions so that only admins can pass arguments
- C. A validation expression such as isnum(ms) with an error message
- D. An argument default value of 0 that replaces non-numeric input

**Answer:** C

**Explanation:** A macro's validation expression is an eval expression evaluated against the arguments, and if it returns false, Splunk shows the configured validation error message instead of running the search. The eval-based definition option changes how the definition is produced, not whether input is checked. Macros do not support argument default values in their definition, and permissions do not validate input.

### Question 8 of 10

A workflow action should be offered only for events that match the event type firewall_deny, regardless of which field the user opens. Which setting achieves this?

- A. Open link in: New window with the search string eventtype=firewall_deny
- B. Show action in: Event menu with the URI set to $eventtype$
- C. Apply only to the following event types: firewall_deny
- D. Apply only to the following fields: eventtype

**Answer:** C

**Explanation:** The event type restriction limits a workflow action to events tagged with the listed event types. Restricting to the eventtype field only controls which field menu shows the action and does not filter by value. Putting $eventtype$ in the URI uses the value but still shows the action for every event, and the link target and search string do not restrict where the action appears.

### Question 9 of 10

An analyst needs a quick count of 404 responses by client from the accelerated Web data model. Which search uses the model's summaries most efficiently?

- A. | tstats count from datamodel=Web where Web.status=404 by Web.src
- B. | pivot Web Web count(Web) AS count FILTER status is 404
- C. | datamodel Web Web search | search status=404 | stats count by src
- D. index=* tag=web status=404 | stats count by src | sort - count

**Answer:** A

**Explanation:** tstats reads the tsidx summaries of an accelerated data model directly and is the fastest way to aggregate over it; field names use the dataset prefix such as Web.status. The datamodel command returns events and then stats processes them, which is slower. Searching raw indexes ignores the summaries entirely, and the pivot command example lacks a split and is not the most efficient approach for this aggregation.

### Question 10 of 10

An analyst normalized a new data source and wants to verify that events now populate the CIM Web data model with the expected fields. Which approach is appropriate?

- A. Run | inputlookup Web and look for the new source type in the lookup rows
- B. Open the CIM add-on documentation and compare its Web field list with a sample event
- C. Run | datamodel Web Web search and check the Web.* fields for the new source type
- D. Confirm under Settings > Data inputs that the new source type is still receiving data

**Answer:** C

**Explanation:** Searching the data model with the datamodel command (or using Pivot or tstats) shows whether events from the new source meet the constraints and which CIM fields are populated. Web is a data model, not a lookup, so inputlookup does not apply. Data inputs only show whether data is being collected, and reading documentation does not test the actual events.

Ready for a timed run? Take the free 15-question SPLK-1002 mini exam: https://devopscodelab.com/app/exams/splunk-splk-1002/mini/

DevOpsCode Lab is not affiliated with Splunk. SPLK-1002 and related names are trademarks of their owners. We write every question ourselves; these are not real exam questions.
