Splunk Search

My search works when I run it manually, but why does it not produce results when I use it to populate a table?

smhsplunk
Communicator
index=main source=locations sourcetype=location_information  
                     | search * AND address=$token1$ OR address="LocationXYZ"
                     | table site_name, address, state, country

When I run this search manually, it works fine, but when I use it in a table, it doesn't do anything

  <table>
        <title>Location</title>
        <search>

          <default>*</default>
          <query>index=main source=locations sourcetype=location_information | search * AND address=$token1$ OR address="LocationXYZ" | table site_name, address, state, country </query>
        </search>

      </table>

I would like to use two tokens also:

search * AND address =$token1$ or address=$token2$

0 Karma

sundareshr
Legend

Try removing the search * and move the address search to base search. Like this

index=main source=locations sourcetype=location_information (address=$token1$ OR address="token2") | table site_name, address, state, country

smhsplunk
Communicator

Your Awesome!

0 Karma

smhsplunk
Communicator

Sorry, seems this is giving me all the rows, not just the one's selected by the token

0 Karma

sundareshr
Legend

Did you have quotes around your tokens? Like this?

index=main source=locations sourcetype=location_information (address="$token1$" OR address="$token2$") | table site_name, address, state, country
0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...