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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...