Splunk Search

Combining Fields from Two Different Seaches

jason_hotchkiss
Communicator

I have two searches:

Search A
index=my_idx sourcetype=my_st Name=conference Message= joined
| stats count by _time Paticipant Conference Display Name Location Protocol

Search B
index=my_idx sourcetype=my_st Name=conference Message= disconnected
| stats count by _time Participant Conference Duration  DisplayName Location Protocol

I would like create a table that combines the Duration field with all the fields from Search A.  I would then like to include a column for the join time and the disconnect time that correlates to the value of Duration.

The output would look like this:

Seach C Out Come

Participant Conference Join_Time Disconnect_Time Duration DisplayName Location Protocol

Thank you,
Jason H.

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
index=my_idx sourcetype=my_st Name=conference (Message=joined OR Message=disconnected)
| eval joined_time=if(Message="joined",_time,null())
| eval disconnected_time=if(Message="disconnected",_time,null())
| stats values(Duration) as Duration values(joined_time) as joined_time values(disconnected_time) as disconnected_time by Participant Conference  DisplayName Location Protocol

View solution in original post

Tags (1)

ITWhisperer
SplunkTrust
SplunkTrust
index=my_idx sourcetype=my_st Name=conference (Message=joined OR Message=disconnected)
| eval joined_time=if(Message="joined",_time,null())
| eval disconnected_time=if(Message="disconnected",_time,null())
| stats values(Duration) as Duration values(joined_time) as joined_time values(disconnected_time) as disconnected_time by Participant Conference  DisplayName Location Protocol
Tags (1)

jason_hotchkiss
Communicator

@ITWhisperer This is great, thank you!

The Duration field display the duration as a value such as 3402.578  I believe this is to be in seconds and miliseconds.  How would I change this to hh:mm:ss?

Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try this:

| eval Duration=tostring(Duration,"duration")
Tags (1)

jason_hotchkiss
Communicator

@ITWhisperer 

I did try this: | eval Duration = strptime(Duration, "%H:%M:%S")
But the out come is like 19:00:10, which doesn't seem possible me.

But your solution did the trick.  I didn't know you could use tostring like that.  

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: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...

Upgrade Prep for 10.4, Network Observability Deep Dives, and More from Splunk Lantern

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...