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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...