Splunk Search

How to build a list of simultaneously running threads?

fiodar_ram
Engager

Given the log events, containing time, name of thread and whether the thread has started or stopped :
_time , thread_name, start/end

How to build a list of thread names that a currently running?

Tags (1)
0 Karma
1 Solution

fiodar_ram
Engager

so to sum up:
1. | concurrency - for counts
2. | eval range=mvrange(start, end, "1h") | mvexpand range | bin span=1h range | stats values(thread_name) as threads count(thread_name) as count by range - for lists, to build missing event entries in time

0 Karma

jdonn_splunk
Splunk Employee
Splunk Employee
0 Karma

fiodar_ram
Engager

but how to build a list of thread names and how the list changes over time?
example:
time | thread names
1h | a,b
2h | a,b,c
3H | a
...

0 Karma

fiodar_ram
Engager

Thank you!

It was exactly what i was looking for! It worked like a charm and i could calculate the count.

But, out of curiosity and naughtiness: how to not just count using concurrency command, but how to build a list?

0 Karma

sundareshr
Legend

You could try something like

... | stats values(thread_name) as threads by start
0 Karma

fiodar_ram
Engager

thank you, but what if i want to know how the list changes over time?

0 Karma

sundareshr
Legend

Try this

... | bin span=1h start | stats values(thread_name) as threads count(thread_name) as count by start
0 Karma

fiodar_ram
Engager

this would give the names and a count of threads, which have started (or have any event) in each hour. but what if a thread has started before an hour and did not stop and did not emit any events in the log. it would not be counted.

0 Karma

sundareshr
Legend

You best bet is to use the concurrency command to get accurate results. Having said that, this will give you everything that started within the hour. This will not give you events that overlap hours. So if it starts at 11:00 and ends at 12:15, will be counted in the 11:00 hr. count

0 Karma

fiodar_ram
Engager

how to list a thread name in the 12:00 hr, if it starts at 11:00 and ends at 13:15? that is the question.

0 Karma

sundareshr
Legend

Try something like this (you'll have to tweak it)

... | eval range=mvrange(start, end, "1h") | mvexpand range | bin span=1h range | stats values(thread_name) as threads count(thread_name) as count by range

0 Karma

fiodar_ram
Engager

that is the magic! thanks! and not so hard after all. should be put in the toolbox for severe cases like that. accepted with gratitude. thank you!

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...