Splunk Search

help on an issue with OR condition

jip31
Motivator

hello

when i execute the search below I have no results
index="tutu" sourcetype="perfmon:logicaldisk" instance="C:" counter="% Free Space" OR index="titi" sourcetype=WinHostMon Type=disk Name="C:" TotalSpaceKB
| eval time = strftime(_time, "%m/%d/%Y %H:%M")
| eval Value = round(Value, 1). " %"
| eval TotalSpace = TotalSpaceKB/1024
| eval TotalSpace = round(TotalSpace/1024,1). " GB"
| stats latest(Value) as Free_Space latest(TotalSpace) as TotalSpace by host

But no matter index I delete I have results
example :

    index="tutu" sourcetype="perfmon:logicaldisk" instance="C:" counter="% Free Space" 
    | eval time = strftime(_time, "%m/%d/%Y %H:%M") 
    | eval Value = round(Value, 1). " %" 
    | eval TotalSpace = TotalSpaceKB/1024 
    | eval TotalSpace = round(TotalSpace/1024,1). " GB" 
    | stats latest(Value) as Free_Space latest(TotalSpace) as TotalSpace by host

 index="titi" sourcetype=WinHostMon Type=disk Name="C:" TotalSpaceKB
    | eval time = strftime(_time, "%m/%d/%Y %H:%M") 
    | eval Value = round(Value, 1). " %" 
    | eval TotalSpace = TotalSpaceKB/1024 
    | eval TotalSpace = round(TotalSpace/1024,1). " GB" 
    | stats latest(Value) as Free_Space latest(TotalSpace) as TotalSpace by host

what is the issue please??

Tags (1)
0 Karma
1 Solution

DavidHourani
Super Champion

Hi @jip31,

Please use the following syntax for the first part of your query and make sure you have results :

(index="tutu" sourcetype="perfmon:logicaldisk" instance="C:" counter="% Free Space" ) OR (index="titi" sourcetype=WinHostMon Type=disk Name="C:" TotalSpaceKB)

Once this is working add the rest :

...   | eval time = strftime(_time, "%m/%d/%Y %H:%M") 
     | eval Value = round(Value, 1). " %" 
     | eval TotalSpace = TotalSpaceKB/1024 
     | eval TotalSpace = round(TotalSpace/1024,1). " GB" 
     | stats latest(Value) as Free_Space latest(TotalSpace) as TotalSpace by host

Let me know if it helps.

Cheers,
David

View solution in original post

0 Karma

DavidHourani
Super Champion

Hi @jip31,

Please use the following syntax for the first part of your query and make sure you have results :

(index="tutu" sourcetype="perfmon:logicaldisk" instance="C:" counter="% Free Space" ) OR (index="titi" sourcetype=WinHostMon Type=disk Name="C:" TotalSpaceKB)

Once this is working add the rest :

...   | eval time = strftime(_time, "%m/%d/%Y %H:%M") 
     | eval Value = round(Value, 1). " %" 
     | eval TotalSpace = TotalSpaceKB/1024 
     | eval TotalSpace = round(TotalSpace/1024,1). " GB" 
     | stats latest(Value) as Free_Space latest(TotalSpace) as TotalSpace by host

Let me know if it helps.

Cheers,
David

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@jip31

Have you tried this?

(index="tutu" sourcetype="perfmon:logicaldisk" instance="C:" counter="% Free Space") OR (index="titi" sourcetype=WinHostMon Type=disk Name="C:" TotalSpaceKB)
| eval time = strftime(_time, "%m/%d/%Y %H:%M")
| eval Value = round(Value, 1). " %"
| eval TotalSpace = TotalSpaceKB/1024
| eval TotalSpace = round(TotalSpace/1024,1). " GB"
| stats latest(Value) as Free_Space latest(TotalSpace) as TotalSpace by host
0 Karma
Get Updates on the Splunk Community!

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...