Splunk Search

Get loginID correlating to another event

tomdepunkt
New Member

Hi everyone,

I'm currently struggling getting the results I want to receive.

I have a different set of logs, but only need information from two of them. One which logs the method used and another log which contains information about the users.

The objective is, to only extract loginIDs which are relating to events happend in the method logs. The only relation between them, is the sessionID, but the amount of logfiles contains so many entries, that a join is just unpractical.

Example Logfiles:

2019-02-20T09:15:10+01:00 hostname_02 server_name: 2019-02-20 09:15:10 INFO  <<<<< object=BackendService_v08, method=getUsername, clID=123456789abcdefg

-

2019-02-20T09:15:15+01:00 hostname_02 server_name: 2019-02-20 09:15:15 INFO  (source='session, httpSessionId='123456789abcdefg') RuntimeUserInfo (loginId='dummy' firstName='Test' lastName='User' userId='1234' clientId='99')

I now want to extract the loginId of the relating user (1234) and the method (getUsername). It is possible, that a user executed more than just one method, which then should be grouped by the clientId. However, the only shared information is the clID which is stored in the httpSessionId. Because of approximately 8 million events, a join containing a subsearch is regarding execution time no appropriate solution.

Is there any feasible way to correlate those events and get the userId together with its used methods?

Thanks in advance.

Tom

0 Karma

knielsen
Contributor

Yeah, you don't want to use join. Let's pretend your sourcetypes are "msglog" and "infolog":

(index=A sourcetype=msglog) OR (index=B sourcetype=infolog) 
| eval id=case(sourcetype="msglog",clID,sourcetype="infolog",httpSessionId)
| stats values(userId) as userId values(method) as method by id

should get be pretty close to what you want.

Tip: Look up the "Let stats sort them out" session recording by Nick Mealy at .conf2016 🙂

Hth,
-Kai.

0 Karma

renjith_nair
Legend

@tomdepunkt,
If you have one user per session, then try

(source="first log file" OR source="second log file")  "other search terms" 
|rename clID as httpSessionId
|stats values(userId) as userId,values(method) as method by httpSessionId
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

tomdepunkt
New Member

@renjith.nair

This actually comes pretty close. It groups the findings of the used methods by the SessionId, but unfortunately doesn't list any loginId at all.

EDIT:
After a small modification and correcting a typo I made, it seems like it works like a charm. Thank you very much, that saves a lot of time.

0 Karma

tomdepunkt
New Member

Hi,

thanks for your suggestion. Unfortunately a user can have different sessions over time. Sorry, that I forgot to mention that in my previous post.

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