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!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...