Splunk Search

I need to write a query to find the sum of same field in same index but with different condition.

nivethainspire_
Explorer

I have tried the below query,it works fine,but its complicated, Can anyone suggest a better way to write the same query,

index="vmt_sample" "Asset Type"=Desktop OR "Thin Client" OR Computer|fillnull value=blank "MS Bulletin" "Flags"|search OS="Windows" |stats sum(CVSS) as CVSS by "Asset Type"|join [search index="vmt_sample" "Asset Type"=Desktop OR "Thin Client" OR Computer |fillnull value=blank "MS Bulletin" "Flags"| search OS="Windows" "MS Bulletin"!=blank "Flags"=blank |stats sum(CVSS_E) as "OS Score" by "Asset Type"]|table "Asset Type",CVSS,"OS Score"

Tags (2)
0 Karma
1 Solution

sundareshr
Legend

Try this

index="vmt_sample" "Asset Type"=Desktop OR "Thin Client" OR Computer OS=Windows
| stats sum(CVSS) as CVSS sum(eval(if(isnotnull("MS Bulletin") AND isnull("Flags"), CVSS_E, 0)))  as "OS Score" by "Asset Type"
| table "Asset Type",CVSS,"OS Score"

View solution in original post

0 Karma

sundareshr
Legend

Try this

index="vmt_sample" "Asset Type"=Desktop OR "Thin Client" OR Computer OS=Windows
| stats sum(CVSS) as CVSS sum(eval(if(isnotnull("MS Bulletin") AND isnull("Flags"), CVSS_E, 0)))  as "OS Score" by "Asset Type"
| table "Asset Type",CVSS,"OS Score"
0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...