What is correct syntax for split function in Splunk eval?
Which of the following is valid syntax for the split function?
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The question tests your ability to recall the exact
evalfunction syntax, and the common trap is confusing assignment (=) with a hyphen or mixing argument order.
The correct answer is B, though it must use an equals sign: | eval areaCodes = split(phoneNumber, "-"). Community consensus confirms that the split function takes a field and delimiter and returns multiple values.
The most common mistake is choosing option B without noticing that it originally says `areaCodes - split(...)` instead of `areaCodes = split(...)`. This makes the expression invalid because `eval` requires a field assignment using `=`.
Community Discussion (4 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
B is the only option that resembles the propereval expression form. In Splunk, the split function is used as split(field, delimiter) and returns a multivalue. Commenters note that B is correct only if the hyphen is replaced with =, as in | eval areaCodes = split(phoneNumber, "-").Why the Other Options Are Wrong
A is invalid becauseeval does not support split phoneNumber by "-" as a bare function call. C puts the arguments in the wrong order and also does not assign to a field correctly. D uses a function call on the left side of a comma and lacks the field assignment syntax that eval requires.Community Comment Notes
Commenters unanimously agree on B and highlight the typo in the printed option, noting that the hyphen should be an equals sign. One commenter suggests correcting it to| eval areaCodes = split(phoneNumber, "-") before selecting B, while another describes the same fix. Official Reference
Exam Strategy
In the exam, check every character in eval expressions — a common trap is a hyphen instead of an equals sign. Remember the exact syntax: | eval new_field = split(existing_field, delimiter).
Related Analysis
Practice All SPLK-1004 Questions
Access 130 questions with complete answers and detailed explanations.
View Full SPLK-1004 Practice Test →