<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Basic search cleanup - Need a list instead of many &amp;quot;OR&amp;quot; operators in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143700#M39933</link>
    <description>&lt;P&gt;Really, "OR" is your only vehicle here.  Splunk breaks searches down into basic AND / OR / NOT boolean logic operators.  The SPL has no concept of an "IN" operator (even if it would be nice just from a syntactic sugar point of view).  There are ways of getting around this though.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Lookups.   You can make a lookup and use inputlookup and a subsearch to drag in the values from the lookup.  Perhaps not appropriate here, but useful elsewhere.&lt;/LI&gt;
&lt;LI&gt;Macros.  Already discussed - hide the complexity for you, but doesn't really simplify it a lot&lt;/LI&gt;
&lt;LI&gt;Tags and eventtypes.  You could use a tag like "interesting_service_name" and tag &lt;CODE&gt;Name=IBM&lt;/CODE&gt; &lt;CODE&gt;Name=CollabNet&lt;/CODE&gt; and so on with that tag and then search for tag=interesting_service_name.  Tags and eventtypes are interesting because they let you encapsulate this type of knowledge in a way that makes dashboards and alert searches much more generic.  I have previously done something where I would make an eventtype highlighting a particular error condition, and then tag that eventtype as "alertable".  Then, I would schedule a search that simply searched for "tag=alertable", and let Splunk figure out what all eventtypes I had tagged that way and what raw events matched that eventtype.  From there, anyone who wanted to add an event to an existing alert trigger would only need to tag it appropriately and things just worked...&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;TL;DR - tags are cool.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:57:42 GMT</pubDate>
    <dc:creator>dwaddle</dc:creator>
    <dc:date>2020-09-28T18:57:42Z</dc:date>
    <item>
      <title>Basic search cleanup - Need a list instead of many "OR" operators</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143695#M39928</link>
      <description>&lt;P&gt;Hello you syntax gurus! &lt;/P&gt;

&lt;P&gt;This should be simple, but haven't done this yet.  &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;  &lt;/P&gt;

&lt;P&gt;I just want to cleanup some of the 'OR' and provide a list instead within parenthesis (I think it's the way it works).  Can you provide a cleaned up example that will search the exactly the same? &lt;/P&gt;

&lt;P&gt;index=app_win source=service State=Stopped StartMode=Manual OR StartMode=Auto Name=&lt;EM&gt;IBM&lt;/EM&gt; OR Name=&lt;EM&gt;CollabNet&lt;/EM&gt; OR Name=&lt;EM&gt;SVN&lt;/EM&gt; OR Name=&lt;EM&gt;Kofax&lt;/EM&gt; OR Name=&lt;EM&gt;QAS&lt;/EM&gt; OR Name=&lt;EM&gt;FLEXLm&lt;/EM&gt; Description=&lt;EM&gt;IBM&lt;/EM&gt; OR Description=&lt;EM&gt;CollabNet&lt;/EM&gt; OR Description=&lt;EM&gt;SVN&lt;/EM&gt; OR Description=&lt;EM&gt;Kofax&lt;/EM&gt; OR Description=&lt;EM&gt;QAS&lt;/EM&gt; OR Description=&lt;EM&gt;FLEXLm&lt;/EM&gt; | stats count by Name StartMode host Description | rename Name as "Service Name"&lt;/P&gt;

&lt;P&gt;Thanks!  &lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2015 22:40:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143695#M39928</guid>
      <dc:creator>agoktas</dc:creator>
      <dc:date>2015-02-12T22:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Basic search cleanup - Need a list instead of many "OR" operators</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143696#M39929</link>
      <description>&lt;P&gt;A simple way of doing this would be to add tags or a lookup to the Name and/or Description fields. If you need matching other than exact match, you could use eventtypes to describe them, and then optionally tag the eventtypes too.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Feb 2015 09:03:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143696#M39929</guid>
      <dc:creator>dart</dc:creator>
      <dc:date>2015-02-13T09:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Basic search cleanup - Need a list instead of many "OR" operators</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143697#M39930</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;if you want to clean this up, i would move the filter part to a search macro. Lets say we call your macro "my_macro".&lt;BR /&gt;
Then your search would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app_win source=service `my_macro` | stats count by Name StartMode host Description | rename Name as "Service Name"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Feb 2015 09:06:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143697#M39930</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2015-02-13T09:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Basic search cleanup - Need a list instead of many "OR" operators</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143698#M39931</link>
      <description>&lt;P&gt;Macros are definitely an option.  &lt;/P&gt;

&lt;P&gt;But I thought there was a comma delimited list you can specify to clean up just a little bit.  Just to clean up some of the "OR" operators and "field=".  &lt;/P&gt;

&lt;P&gt;Just a guess (I thought it was something like this)...&lt;BR /&gt;
Name=(&lt;EM&gt;IBM&lt;/EM&gt;,&lt;EM&gt;CollabNet&lt;/EM&gt;,&lt;EM&gt;SVN&lt;/EM&gt;,&lt;EM&gt;Kofax&lt;/EM&gt;,&lt;EM&gt;QAS&lt;/EM&gt;,&lt;EM&gt;FLEXLm&lt;/EM&gt;)&lt;BR /&gt;
Description=(&lt;EM&gt;IBM&lt;/EM&gt;,&lt;EM&gt;CollabNet&lt;/EM&gt;,&lt;EM&gt;SVN&lt;/EM&gt;,&lt;EM&gt;Kofax&lt;/EM&gt;,&lt;EM&gt;QAS&lt;/EM&gt;,&lt;EM&gt;FLEXLm&lt;/EM&gt;)&lt;/P&gt;

&lt;P&gt;But I tried these and they don't work. &lt;/P&gt;

&lt;P&gt;Thanks. &lt;/P&gt;</description>
      <pubDate>Fri, 13 Feb 2015 17:38:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143698#M39931</guid>
      <dc:creator>agoktas</dc:creator>
      <dc:date>2015-02-13T17:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Basic search cleanup - Need a list instead of many "OR" operators</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143699#M39932</link>
      <description>&lt;P&gt;Aha!  I've taken 1 step forward:  &lt;/P&gt;

&lt;P&gt;index=app_win source=service State=Stopped StartMode (Auto OR Manual) &lt;BR /&gt;
Name (&lt;EM&gt;IBM&lt;/EM&gt; OR &lt;EM&gt;CollabNet&lt;/EM&gt; OR &lt;EM&gt;SVN&lt;/EM&gt; OR &lt;EM&gt;Kofax&lt;/EM&gt; OR &lt;EM&gt;QAS&lt;/EM&gt; OR &lt;EM&gt;FLEXLm&lt;/EM&gt;) OR&lt;BR /&gt;
Description (&lt;EM&gt;IBM&lt;/EM&gt; OR &lt;EM&gt;CollabNet&lt;/EM&gt; OR &lt;EM&gt;SVN&lt;/EM&gt; OR &lt;EM&gt;Kofax&lt;/EM&gt; OR &lt;EM&gt;QAS&lt;/EM&gt; OR &lt;EM&gt;FLEXLm&lt;/EM&gt;) OR&lt;BR /&gt;
DisplayName (&lt;EM&gt;IBM&lt;/EM&gt; OR &lt;EM&gt;CollabNet&lt;/EM&gt; OR &lt;EM&gt;SVN&lt;/EM&gt; OR &lt;EM&gt;Kofax&lt;/EM&gt; OR &lt;EM&gt;QAS&lt;/EM&gt; OR &lt;EM&gt;FLEXLm&lt;/EM&gt;)&lt;BR /&gt;
NOT (Description=&lt;EM&gt;Blah1&lt;/EM&gt; OR &lt;EM&gt;Blah2&lt;/EM&gt;) | stats count by DisplayName StartMode host Description | rename DisplayName as "Service Name"&lt;/P&gt;

&lt;P&gt;This brings up the exact same results, but is a bit cleaner.  Now I just need to know how to clean up some of the redundant "OR" operators.&lt;BR /&gt;&lt;BR /&gt;
Any thoughts? &lt;/P&gt;

&lt;P&gt;Or is this the best (besides creating a macro) we can do with cleanup?  &lt;/P&gt;</description>
      <pubDate>Fri, 13 Feb 2015 22:30:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143699#M39932</guid>
      <dc:creator>agoktas</dc:creator>
      <dc:date>2015-02-13T22:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Basic search cleanup - Need a list instead of many "OR" operators</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143700#M39933</link>
      <description>&lt;P&gt;Really, "OR" is your only vehicle here.  Splunk breaks searches down into basic AND / OR / NOT boolean logic operators.  The SPL has no concept of an "IN" operator (even if it would be nice just from a syntactic sugar point of view).  There are ways of getting around this though.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Lookups.   You can make a lookup and use inputlookup and a subsearch to drag in the values from the lookup.  Perhaps not appropriate here, but useful elsewhere.&lt;/LI&gt;
&lt;LI&gt;Macros.  Already discussed - hide the complexity for you, but doesn't really simplify it a lot&lt;/LI&gt;
&lt;LI&gt;Tags and eventtypes.  You could use a tag like "interesting_service_name" and tag &lt;CODE&gt;Name=IBM&lt;/CODE&gt; &lt;CODE&gt;Name=CollabNet&lt;/CODE&gt; and so on with that tag and then search for tag=interesting_service_name.  Tags and eventtypes are interesting because they let you encapsulate this type of knowledge in a way that makes dashboards and alert searches much more generic.  I have previously done something where I would make an eventtype highlighting a particular error condition, and then tag that eventtype as "alertable".  Then, I would schedule a search that simply searched for "tag=alertable", and let Splunk figure out what all eventtypes I had tagged that way and what raw events matched that eventtype.  From there, anyone who wanted to add an event to an existing alert trigger would only need to tag it appropriately and things just worked...&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;TL;DR - tags are cool.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:57:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-search-cleanup-Need-a-list-instead-of-many-quot-OR-quot/m-p/143700#M39933</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2020-09-28T18:57:42Z</dc:date>
    </item>
  </channel>
</rss>

