Splunk Search

Matching field from two different index and source

Sekhar
Explorer

I have two event start event having extracted fields from log  managerid ,branch I'd,empname using index = emp source = empsource " offer letters"

End event having extracted field empid,branch id index= manager source= manager source " relieving letters" 

I want to get empid who's is taken offer letter and relieving later and duration.

 

Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Sekhar,

let me understand, you can correlate events using the id field or there some other corrrelation rule?

if you can use id to correlate events, you could try something like this:

(index=emp source=empsource " offer letters") OR (index=manager source=manager source " relieving letters")
| stats 
   earliest(_time) AS earliest
   latest(_time) AS latest
   values(branch) AS branch
   values(managerid) AS managerid
   values(empname) AS empname 
   BY id
| eval diff =latest-earliest,
| eval earliest=strftime(earliest,"%Y-%m-%d %H:%M:%S"), latest=strftime(latest,"%Y-%m-%d %H:%M:%S")

Ciao.

Giuseppe

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!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...