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!

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, ...