Security

Find the current logged in user via python script

ppurokit
Path Finder

Hi All,

I have the following requirement:

I have three users with the same permissions. Each user has been provided permission only to access his own created Index.

For Example:

User 1 --> Index 1

User 2 --> Index 2

User 3 --> Index 3

I have a dashboard created which has some search queries which is common for all the logged in users.

When user1 schedules a dashboard report , the "sendemail.py" script gets triggered generating the PDF.

I need to append the user name on which user has scheduled to run the report, to the file name of the pdf which gets generated.

I know that authorize.conf is a file which stores all the user's details on providing which user has access to which indexes and other details.

I need the user who has scheduled the report so that , if i know the user name i can access authorize.conf file and get other details also about that user.

Please help me on how i can achieve the same.

0 Karma

somesoni2
Revered Legend

Following answer has the custom python script to get the current user name. Hope this helps.

0 Karma
Get Updates on the Splunk Community!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...