Splunk Search

Can you help me with my subsearch?

jip31
Motivator

Hello

I try to combine the 2 queries below

QUERY 1

    index="ai-wkst-wineventlog-fr" sourcetype=XmlWinEventLog source="XmlWinEventLog:Application"
    Level=1 OR Level=3 Name=* 
    | dedup _time Name 
    | stats count as Erreurs by host| sort - Erreurs limit=10 

QUERY 2

 index="ai-wkst-windows-fr" sourcetype=WinRegistry key_path="\\registry\\machine\\software\\wow6432node\\XX\\master\\WindowsVersion" 
        OR 
        key_path="\\registry\\machine\\software\\microsoft\\windows nt\\currentversion\\ReleaseId" 
    | eval OS=if(key_path=="\\registry\\machine\\software\\wow6432node\\XX\\master\\WindowsVersion",data, null), 
        Build=if(key_path=="\\registry\\machine\\software\\microsoft\\windows nt\\currentversion\\ReleaseId",data,null) 

I want to stats the event like this:

For one hostname, I want to count errors (query 1) by OS and by Build (query 2).

I tried something like this, but it doesn't work:

index="ai-wkst-wineventlog-fr" sourcetype=XmlWinEventLog source="XmlWinEventLog:Application"
Level=1 OR Level=3 Name=* 
| dedup _time Name 
| stats count as Erreurs by host| sort - Erreurs limit=10 |append 
    [ search index="ai-wkst-windows-fr" sourcetype=WinRegistry key_path="\\registry\\machine\\software\\wow6432node\\XX\\master\\WindowsVersion" 
        OR 
        key_path="\\registry\\machine\\software\\microsoft\\windows nt\\currentversion\\ReleaseId" 
    | eval OS=if(key_path=="\\registry\\machine\\software\\wow6432node\\XX\\master\\WindowsVersion",data, null), 
        Build=if(key_path=="\\registry\\machine\\software\\microsoft\\windows nt\\currentversion\\ReleaseId",data,null) 
    | stats latest(OS) as OS latest(Build) as Build by host, Erreurs ] 
| stats values(OS) as OS values(Build) as Build by host, Erreurs|

Could you help me please??

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