Splunk Search

Splunk Query

rahul2gupta
Path Finder

Hi @gcusello ,

Can you please help me to design a Splunk query to show whether a particular user has been coming into the office at Mascot (and/ or Erskine Park), or otherwise working from home (or elsewhere).

I'd like to structure the results to show a table listing logon time and IP address - like this:

 Workstation    Last Login          User
 10.11.12.13    15-11-01 10:00:00   user1
 10.12.13.14    15-11-01 15:34:02

Regards,

Rahul

 

0 Karma

venkatasri
SplunkTrust
SplunkTrust

Hi @rahul2gupta 

As @gcusello mentioned there should be some data in your logs associated to User being already logged in from a place. You have to dig through logs under the index you mentioned to find the location/address/IP from the user logged in. Alternatively you can provide the sample events how they looks like as we do not have insights into your data.

The data could be sensitive to your company confidential then you have to mask/alter it before you share here for your confidentiality.

0 Karma

rahul2gupta
Path Finder

Hi @venkatasri ,

Just found the logs associated to User.

index=main sourcetype="activedirectory". I want to add IP Address column as well but couldn't find in interesting fields. please help us to do this.

rahul2gupta_0-1624949423985.png

We can only fetch last 14 days events but I checked the configuration of index=main and the retention period was 6 months . Also, please help me to understand this.

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @rahul2gupta,

I'd like to help you, but youshould explain how can we define the location of a user, the only way I can see (tell me if there's something helpful else ) is the IP address:

e.g.

if IP address is 10.11.*.* the location is Mascot

if IP address is 10.12.*.* the location is Erskine Park,

otherwise is outside

can this condition to be correct?

if this is the condition to define the user location, you can use a simple if or case condition in an eval command, something like this:

your_search
| eval location=if(substr(Workstation,1,5)="10.11","Mascot",if(substr(Workstation,1,5)="10.12","Erskine Park","Outside")), "Last Login"=strftime(_time,"%Y-%m-%d %H:%M:%S")
| table Workstation "Last Login" User

Ciao.

Giuseppe

0 Karma

rahul2gupta
Path Finder

Hi @gcusello ,

You mentioned Your_search in the query that you provided but I'm not sure what to use in my search as user  has just asked to show a user’s working location. Can you please me on this.

I used index = security sourcetype=history* but it didn't helped me.

rahul2gupta_0-1624932475318.png

 

Regards,

Rahul Gupta

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...