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 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...