I tried to set an input which displays the name of the user who open the dashboard.
I tried a dropdown input where the default is my username and it works well :
But my username appears when other user open the dashboard with their own username (they have both mine and theirs), instead only theirs.
So I checked the code, and what I found is when I select mine as default, it retained mine in the code :
<input type="dropdown" token="user_tok" searchWhenChanged="true"><label>your username is :</label><fieldForLabel>username</fieldForLabel><fieldForValue>username</fieldForValue><search><query>| rest /services/authentication/current-context splunk_server=local | fields roles username | mvexpand roles| fields username</query></search><change><condition match="isnotnull($value$) AND $value$!="""><set token="tokTextFilter">$value$</set></condition></change><default>gxxxx</default>
I tried to set the token input in the default :
But nothing changed.
How can I set by default and displays only the username who goes to the dashboard ?
Thanks for your help !
Can you try the below one.
<input type="dropdown" token="user"><label>field1</label><prefix>user_token</prefix><fieldForLabel>username</fieldForLabel><fieldForValue>username</fieldForValue><search><query>| rest /services/authentication/current-context splunk_server=local| fields roles username| mvexpand roles| fields username</query><earliest>-24h@h</earliest><latest>now</latest></search></input>
I tried your code, but it gave me this :
What I want is to have automatically the username selected by default, and not to click on "Select".
That's why I tried to put the token into the <default> value, but it does not work at all.
I use this user token in multiple queries on my dashboard, and since there is only one value for a user then I would like this value to be the default.