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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...