Splunk Search

SPL querry

srujana96
Explorer

I have a lookup with server details and OS details(details are in the below table), and the index with CR no., Date, server and status.  so, with respective to the CR no. the total no. of server which are patched is 4(irrespective of the status whether it is success or failure)  and the rest of the server in my lookup table is not patched with respect to that CR no.
i want to write the query in order to get the count of the server which are not patched
with respect to that CR no. that is the count is 11.

Please Note: I need this query to show case the count of server that are not patched in the dashboard.

lookup   Index   
ServerOS  CR No.DateServerStatus
1Unix  11-Jan1Success
2Win  11-Jan2Success
3Unix  11-Jan3Success
4Win  11-Jan4fail
5Unix  225-Dec5Success
6Win  225-Dec6fail
7Unix  225-Dec7fail
8Win  31-Nov8Success
9Unix  31-Nov9Success
10Win      
11Unix      
12Win      
13Unix      
14Win      
15Unix      
Labels (1)
0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @srujana96,

Please try below sample;

index=patch_index 
| stats dc(Server) as patch_count by CR_No 
| append
    [| inputlookup server_details 
    | stats count as server_count] 
| eventstats max(server_count) as server_count 
| eval not_patched_count=server_count-patch_count 
| table CR_No not_patched_count

 

If this reply helps you an upvote is appreciated.

If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

scelikok
SplunkTrust
SplunkTrust

Hi @srujana96,

Please try below sample;

index=patch_index 
| stats dc(Server) as patch_count by CR_No 
| append
    [| inputlookup server_details 
    | stats count as server_count] 
| eventstats max(server_count) as server_count 
| eval not_patched_count=server_count-patch_count 
| table CR_No not_patched_count

 

If this reply helps you an upvote is appreciated.

If this reply helps you an upvote and "Accept as Solution" is appreciated.
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!

Painting a Clearer Picture: Unifying Your Investigations with Cisco AI Canvas

Painting a Clearer Picture: Unifying Your Investigations with Cisco AI Canvas  We’ve all been there. You’re ...

Hello POJO, meet nocode

What's the Challenge? Instrumentation agents are highly advanced bits of software that manipulate bytecode, ...

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