nerdexam
Splunk

SPLK-1002 · Question #26

Given the macro definition below, what should be entered into the Name and Arguments fileds to correctly configured the macro?

The correct answer is B. The macro name is sessiontracker(2) and the arguments are action, JESSIONID. The macro definition below shows a macro that tracks user sessions based on two arguments: action and JSESSIONID. sessiontracker(2) The macro definition does the following: It specifies the name of the macro as sessiontracker. This is the name that will be used to execute the…

Creating and Using Macros

Question

Given the macro definition below, what should be entered into the Name and Arguments fileds to correctly configured the macro?

Exhibit

SPLK-1002 question #26 exhibit

Options

  • AThe macro name is sessiontracker and the arguments are action, JESSIONID.
  • BThe macro name is sessiontracker(2) and the arguments are action, JESSIONID.
  • CThe macro name is sessiontracker and the arguments are $action$, $JESSIONID$.
  • DThe macro name is sessiontracker(2) and the Arguments are $action$, $JESSIONID$.

How the community answered

(27 responses)
  • B
    89% (24)
  • C
    4% (1)
  • D
    7% (2)

Explanation

The macro definition below shows a macro that tracks user sessions based on two arguments: action and JSESSIONID. sessiontracker(2) The macro definition does the following: It specifies the name of the macro as sessiontracker. This is the name that will be used to execute the macro in a search string. It specifies the number of arguments for the macro as 2. This indicates that the macro takes two arguments when it is executed. It specifies the code for the macro as index=main sourcetype=access_combined_wcookie action=$action$ JSESSIONID=$JSESSIONID$ | stats count by JSESSIONID. This is the search string that will be run when the macro is executed. The search string can contain any part of a search, such as search terms, commands, arguments, etc. The search string can also include variables for the arguments using dollar signs around them. In this case, action and JSESSIONID are variables for the arguments that will be replaced by their values when the macro is executed. Therefore, to correctly configure the macro, you should enter sessiontracker as the name and action, JSESSIONID as the arguments. Alternatively, you can use sessiontracker(2) as the name and leave the arguments blank.

Topics

#Splunk macros#Macro configuration#Macro arguments#Macro syntax

Community Discussion

No community discussion yet for this question.

Full SPLK-1002 Practice