All Apps and Add-ons

How to find name of the currently logged in user in Splunk Web Framework App?

mshapirovp
Explorer

In a web framework app, is it possible (via javascript) to get the name of the currently logged in user?

I would like to provide this in an ajax call when the user performs an action.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

If you require splunkjs/mvc/sharedmodels then you can run this:

console.log(sharedModels.get("user").entry.get("name"));
console.log(sharedModels.get("user").entry.content.get("realname"));

Produces this output:

"admin"
"Administrator"
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...