<?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: Splunk Search Command, Regex, and OR Operator in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691881#M235544</link>
    <description>&lt;P&gt;Thank you !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jun 2024 17:48:23 GMT</pubDate>
    <dc:creator>fzuazo</dc:creator>
    <dc:date>2024-06-27T17:48:23Z</dc:date>
    <item>
      <title>SOLVED - Splunk Search Command, Regex, and OR Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691857#M235530</link>
      <description>&lt;P&gt;Greetings all,&lt;/P&gt;&lt;P&gt;I'm trying to search inside a lookup table and I need to use a search command follow by an OR and regex&lt;/P&gt;&lt;P&gt;I need the regex to match anything in the lookup table and not just the two fields before it.&lt;/P&gt;&lt;P&gt;Below is some sample SPL, I know it won't work this way but I'm including it to give an idea of what I'm trying to accomplish.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup data_source.csv
| fillnull value=MISSING
| search (count=MISSING AND percent=MISSING) OR regex "[^0-9a-zA-Z\-\._,]"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for the help, I really appreciate it.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 17:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691857#M235530</guid>
      <dc:creator>fzuazo</dc:creator>
      <dc:date>2024-06-27T17:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Search Command, Regex, and OR Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691859#M235531</link>
      <description>&lt;P&gt;The search command and regex command by default work on the _raw field. This is normally present in the events in your index. Since your events are coming from a lookup, it is unlikely that you have a _raw field, which means you need to specify a field for the regex command to filter on.&lt;/P&gt;&lt;P&gt;Can you rewrite your filter requirement such that it can be applied to fields returned by your inputlookup?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 15:14:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691859#M235531</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-27T15:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Search Command, Regex, and OR Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691863#M235532</link>
      <description>&lt;P&gt;Thanks for the input.&lt;/P&gt;&lt;P&gt;I can definitely do that but I need to make sure that the regex searches are chained with ORs to the previous searches.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 15:25:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691863#M235532</guid>
      <dc:creator>fzuazo</dc:creator>
      <dc:date>2024-06-27T15:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Search Command, Regex, and OR Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691867#M235533</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup data_source.csv
| fillnull value="MISSING"
| where (count="MISSING" AND percent="MISSING") OR match(count, "[^0-9a-zA-Z\-\._,]") OR match(percent, "[^0-9a-zA-Z\-\._,]")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 27 Jun 2024 15:52:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691867#M235533</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-27T15:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Search Command, Regex, and OR Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691868#M235534</link>
      <description>&lt;P&gt;First, you want to familiarize yourself with&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Where" target="_blank" rel="noopener"&gt;where&lt;/A&gt;&amp;nbsp;command and how it differs from search command. &amp;nbsp;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;said, search operates on _raw field. &amp;nbsp;Because inputlookup does not produce raw events, you need to specify which field or fields from data_source.csv to apply that regex. &amp;nbsp;Suppose all you want to do is to match a field named somefield, your search can be simply:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup data_source.csv
| where (isnull(count) AND isnull(percent)) OR match(somefield, "[^0-9a-zA-Z\-\._,]")&lt;/LI-CODE&gt;&lt;P&gt;Here, there is no need to fillnull because &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/InformationalFunctions#isnull.28.26lt.3Bvalue.26gt.3B.29" target="_blank" rel="noopener"&gt;isnull&lt;/A&gt; function test the condition without a spurious assignment.&lt;/P&gt;&lt;P&gt;Now, if you want to apply that regex to every field from this lookup, the following should work but that's really not what Splunk is designed to do.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup data_source.csv
| foreach *
    [eval allfields = if(isnull(allfields), "", allfields) . &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]
| where (isnull(count) AND isnull(percent)) OR match(allfields, "[^0-9a-zA-Z\-\._,]")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 15:54:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691868#M235534</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-06-27T15:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Search Command, Regex, and OR Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691881#M235544</link>
      <description>&lt;P&gt;Thank you !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 17:48:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SOLVED-Splunk-Search-Command-Regex-and-OR-Operator/m-p/691881#M235544</guid>
      <dc:creator>fzuazo</dc:creator>
      <dc:date>2024-06-27T17:48:23Z</dc:date>
    </item>
  </channel>
</rss>

