exam questions

Exam SPLK-1002 All Questions

View all questions & answers for the SPLK-1002 exam

Exam SPLK-1002 topic 1 question 33 discussion

Actual exam question from Splunk's SPLK-1002
Question #: 33
Topic #: 1
[All SPLK-1002 Questions]

Which of the following searches show a valid use of a macro? (Choose all that apply.)

  • A. index=main source=mySource oldField=* |'makeMyField(oldField)'| table _time newField
  • B. index=main source=mySource oldField=* | stats if('makeMyField(oldField)') | table _time newField
  • C. index=main source=mySource oldField=* | eval newField='makeMyField(oldField)'| table _time newField
  • D. index=main source=mySource oldField=* | "'newField('makeMyField(oldField)')'" | table _time newField
Show Suggested Answer Hide Answer
Suggested Answer: AC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Powdered_Sugar
Highly Voted 3 years ago
B can't be true, it has a malformed if statement. I think it's A & C.
upvoted 26 times
Steve2610
1 year, 5 months ago
https://docs.splunk.com/Documentation/Splunk/9.0.0/Knowledge/Usesearchmacros
upvoted 1 times
Steve2610
1 year, 5 months ago
Search macros can be any part of a search, such as an eval statement or search term and do not need to be a complete command. Macros inside of quoted values are not expanded.
upvoted 1 times
...
...
...
Teloif
Most Recent 1 month, 3 weeks ago
Selected Answer: AC
AC are correct
upvoted 3 times
...
Dree_Dogg
4 months, 2 weeks ago
Selected Answer: AC
A, C Can't be B because "if" takes 3 arguments.
upvoted 2 times
...
poubellelc66
6 months, 1 week ago
I'm I the only one that see there's no "NewField" in the A search and that would likely result in the search not working. For me only C is working in terms of macro's and search. But maybe I'm wrong.
upvoted 2 times
...
mohanmk95
8 months ago
Selected Answer: AC
please check in splunk also
upvoted 2 times
...
Harrysa
8 months, 3 weeks ago
Only A works why are the others being suggested?
upvoted 1 times
...
TestingAccount900
1 year, 3 months ago
Selected Answer: AC
A and C are correct. Anyone saying C is wrong due to quotes is ignoring the fact macro's use ` ` syntax
upvoted 3 times
...
huu_nguyen
1 year, 11 months ago
Only A is correct B is incorrect since the if statement was malformed C is incorrect since the field value must be quoted by double-quotes, not single-quotes D is incorrect obviously
upvoted 2 times
...
Iman1367
2 years, 2 months ago
AC are correct
upvoted 1 times
...
M9201715
2 years, 2 months ago
A and C are correct. A obviously, and C works because I just tried it
upvoted 2 times
...
Hudda
2 years, 5 months ago
which one is the final answer friends, could you pls confirm.
upvoted 2 times
...
Lalithadevi
2 years, 9 months ago
A is Correct
upvoted 4 times
...
IxlJustinlxl
2 years, 11 months ago
I think the only answer is A based off what I read here: https://community.splunk.com/t5/Knowledge-Management/How-to-pass-field-values-as-macro-arguments/m-p/164018 BD are for sure incorrect (improper use of back ticks (D) and no function following stats command (B)) C however, I think is also wrong because eval evaluates mathematical, string, and boolean expressions.. therefore eval newField='makeMyField(oldField)' would take oldField as a string and not as an argument.
upvoted 2 times
subham29
1 year, 11 months ago
if it was in single quote then it eval would have taken that as string.. but here it is in back tick
upvoted 1 times
...
...
_pasha
2 years, 11 months ago
A, C correct answers
upvoted 2 times
...
akkki
3 years, 2 months ago
@kbisht : Why not C or D?
upvoted 1 times
nirmaljohnson
3 years, 1 month ago
Not Sure what does D do ? I think A & C are correct. | eval n=`tostringnumber(15)` where as the macro is tostring($number$, "hex") , If I understood the option C correctly , this works.
upvoted 5 times
...
...
kbisht
3 years, 3 months ago
Correct ans is A
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago