Splunk Search

Subsearch on results

omgwut56k
Path Finder

Hi Answers, hopefully someone can help me figure this out.

I need to see a list of all results and a distinct count of all programs running for each host, and specifically which computers,users are running a specific program e.g logon.exe

Example data:

host=computer1 user=joe,user program=Logon.exe
host=computer1 user=joe,user program=word.exe
host=computer1 user=joe,user program=notepad.exe

host=computer2 user=jane,user program=outlook.exe
host=computer2 user=jane,user program=lotus.exe
host=computer2 user=jane,user program=notepad.exe

host=computer3 user=dave,user program=outlook.exe
host=computer3 user=dave,user program=lotus.exe
host=computer3 user=dave,user program=notepad.exe

Expected results,
computer_name user, count_of_running_programs count_of_logon.exe

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

I think you can do this without a subsearch. Try index=foo | stats dc(program) as programCount, dc(eval(program="Logon.exe")) as logonCount by host, user | table host user programCount logonCount.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

I think you can do this without a subsearch. Try index=foo | stats dc(program) as programCount, dc(eval(program="Logon.exe")) as logonCount by host, user | table host user programCount logonCount.

---
If this reply helps you, Karma would be appreciated.

omgwut56k
Path Finder

Perfect! Thank you.

0 Karma

omgwut56k
Path Finder

Bonus points.. if you can help me identify users logged into multiple computers.. Bonus Bonus points if I can display both computes in a multi-value field as a result of the stats command.

0 Karma

woodcock
Esteemed Legend

Bonus points:

index=foo | stats dc(program) as programCount, dc(eval(program="Logon.exe")) as logonCount by host, user | table host user programCount logonCount | eventstats values(hosts) AS hosts by user
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...