<?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: multiple occurences of one field - from rex to field-extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/multiple-occurences-of-one-field-from-rex-to-field-extraction/m-p/549506#M155920</link>
    <description>&lt;P&gt;Use the field name in your search.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="dev_logs" pod::apollo* some.url.com/api statusCode 
| rex field=_raw max_match=0 "\"statusCode\":(?&amp;lt;ApolloStatusCode&amp;gt;\d+)"
| search NOT (ApolloStatusCode=200 OR ApolloStatusCode=204)&lt;/LI-CODE&gt;&lt;P&gt;That's the normal case, but you're using &lt;FONT face="courier new,courier"&gt;max_match=0&lt;/FONT&gt;, which produces a multi-value field and that's not so normal.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="dev_logs" pod::apollo* some.url.com/api statusCode 
| rex field=_raw max_match=0 "\"statusCode\":(?&amp;lt;ApolloStatusCode&amp;gt;\d+)"
| where (isnull(mvfind(ApolloStatusCode, 200)) AND isnull(mvfind( ApolloStatusCode,204)))&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 27 Apr 2021 18:11:38 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2021-04-27T18:11:38Z</dc:date>
    <item>
      <title>multiple occurences of one field - from rex to field-extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-occurences-of-one-field-from-rex-to-field-extraction/m-p/549455#M155900</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;so I have a search that results contains &lt;STRONG&gt;multiple occurences of one field&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;My current solution is using &lt;STRONG&gt;rex&lt;/STRONG&gt; together with &lt;STRONG&gt;max_match=0&lt;/STRONG&gt; in order to get this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;index="dev_logs" pod::apollo* some.url.com/api statusCode | rex field=_raw max_match=0 "\"statusCode\":(?&amp;lt;ApolloStatusCode&amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Well, right now I want an alert for the case that status is &lt;STRONG&gt;neither 200 nor 204&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;So I played around with this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| search 200 OR search 204

| search NOT 200 AND search NOT 204

| search NOT [search 200 OR search 204]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To be honest neither works &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now I think that the sub-search is the problem, and a solution could be to use field-extraction.&lt;/P&gt;&lt;P&gt;So I used the &lt;STRONG&gt;field extraction&lt;/STRONG&gt; wizard and changed the generated regex to this afterwards:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"statusCode":(?&amp;lt;ApolloStatusCode&amp;gt;\d+)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this only returns the first occurence - but I need them all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With &lt;STRONG&gt;field transformation&lt;/STRONG&gt; I didn't make any progress, and editing some conf files are out of scope...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 12:34:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-occurences-of-one-field-from-rex-to-field-extraction/m-p/549455#M155900</guid>
      <dc:creator>Marco204</dc:creator>
      <dc:date>2021-04-27T12:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: multiple occurences of one field - from rex to field-extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-occurences-of-one-field-from-rex-to-field-extraction/m-p/549506#M155920</link>
      <description>&lt;P&gt;Use the field name in your search.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="dev_logs" pod::apollo* some.url.com/api statusCode 
| rex field=_raw max_match=0 "\"statusCode\":(?&amp;lt;ApolloStatusCode&amp;gt;\d+)"
| search NOT (ApolloStatusCode=200 OR ApolloStatusCode=204)&lt;/LI-CODE&gt;&lt;P&gt;That's the normal case, but you're using &lt;FONT face="courier new,courier"&gt;max_match=0&lt;/FONT&gt;, which produces a multi-value field and that's not so normal.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="dev_logs" pod::apollo* some.url.com/api statusCode 
| rex field=_raw max_match=0 "\"statusCode\":(?&amp;lt;ApolloStatusCode&amp;gt;\d+)"
| where (isnull(mvfind(ApolloStatusCode, 200)) AND isnull(mvfind( ApolloStatusCode,204)))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 27 Apr 2021 18:11:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-occurences-of-one-field-from-rex-to-field-extraction/m-p/549506#M155920</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-04-27T18:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: multiple occurences of one field - from rex to field-extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-occurences-of-one-field-from-rex-to-field-extraction/m-p/549587#M155955</link>
      <description>&lt;P&gt;Thanks a lot for your answer. In between I was able to combine field transformation and field extraction, so right now I have the variable named MARCO. In a search over the last 30 day there occur 3 values: 200, 204 and 400. But using your where-clause returns no results at all. And the 2nd param of the mvfind function is a regex, so it has to be quoted.&lt;BR /&gt;&lt;BR /&gt;Here some results:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where isnull(mvfind(MARCO,"204"))&lt;/LI-CODE&gt;&lt;P&gt;return the 200 and 400.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where isnull(mvfind(MARCO,"400"))&lt;/LI-CODE&gt;&lt;P&gt;return the 200 and 204.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where isnull(mvfind(MARCO,"200"))&lt;/LI-CODE&gt;&lt;P&gt;return 0 events. &lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So now I need to explain the results a normal search without where-clause.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;200,204,200&lt;/LI&gt;&lt;LI&gt;200&lt;/LI&gt;&lt;LI&gt;200,204&lt;/LI&gt;&lt;LI&gt;200,400&lt;/LI&gt;&lt;LI&gt;200,200,204&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;So somehow there is always a 200, and removing those results in 0 events.&lt;/P&gt;&lt;P&gt;Do you know another way of filtering?&lt;/P&gt;&lt;P&gt;Currently I want the (200,400) and maybe in the future I will get something like (200,500) or (200,404) which I also want...&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Marco&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 10:30:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-occurences-of-one-field-from-rex-to-field-extraction/m-p/549587#M155955</guid>
      <dc:creator>Marco204</dc:creator>
      <dc:date>2021-04-28T10:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: multiple occurences of one field - from rex to field-extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multiple-occurences-of-one-field-from-rex-to-field-extraction/m-p/549610#M155960</link>
      <description>&lt;P&gt;Try this search for non-200 result codes.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="dev_logs" pod::apollo* some.url.com/api statusCode 
| rex field=_raw max_match=0 "\"statusCode\":(?&amp;lt;ApolloStatusCode&amp;gt;\d+)"
| where isnotnull(mvfind(ApolloStatusCode, "[3-9]\d{2}")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 28 Apr 2021 13:03:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multiple-occurences-of-one-field-from-rex-to-field-extraction/m-p/549610#M155960</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-04-28T13:03:04Z</dc:date>
    </item>
  </channel>
</rss>

