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!

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

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...