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 Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...