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!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...