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.
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...