<?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: Help with eval case match in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-achieve-eval-case-match/m-p/627386#M15128</link>
    <description>&lt;P&gt;I needed to use indeed a rex&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2023 19:36:01 GMT</pubDate>
    <dc:creator>maxouhunterfc</dc:creator>
    <dc:date>2023-01-17T19:36:01Z</dc:date>
    <item>
      <title>How to achieve eval case match?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-achieve-eval-case-match/m-p/627378#M15124</link>
      <description>&lt;P&gt;event is json:&lt;/P&gt;
&lt;P&gt;{message:AZK} x 10&lt;/P&gt;
&lt;P&gt;{message:BCK} x 5&lt;/P&gt;
&lt;P&gt;{message:C} x 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What Im trying to get is a table to count message by values with a modified text&lt;/P&gt;
&lt;P&gt;Message AZK -&amp;nbsp; 10&lt;/P&gt;
&lt;P&gt;Message BCK -&amp;nbsp; 5&lt;/P&gt;
&lt;P&gt;C - 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use this:&lt;/P&gt;
&lt;P&gt;| eval extended_message= case(&lt;BR /&gt;match(_raw,"AZK"),"Message AZK",&lt;BR /&gt;match(_raw,"BCK"),"Message BCK",&lt;BR /&gt;1=1, message)&lt;BR /&gt;| stats count as nombre by extended_message&lt;BR /&gt;| sort nombre desc&lt;BR /&gt;| table extended_message, nombre&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't not get the "C" in the list to be counted&lt;/P&gt;
&lt;P&gt;the message from the JSON event is not interpreted (i don't know)&lt;/P&gt;
&lt;P&gt;Thanks for your help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 20:21:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-achieve-eval-case-match/m-p/627378#M15124</guid>
      <dc:creator>maxouhunterfc</dc:creator>
      <dc:date>2023-01-17T20:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help with eval case match</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-achieve-eval-case-match/m-p/627380#M15125</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252996"&gt;@maxouhunterfc&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think you have to extract message value from raw. Bcoz it looks _raw is not a valid json.&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; 
| rex field=_raw "message:(?&amp;lt;message&amp;gt;.*)}" 
| eval extended_message= case(
    match(_raw,"AZK"),"Message AZK",
    match(_raw,"BCK"),"Message BCK",
    1=1, message) 
| stats count as nombre by extended_message 
| sort nombre desc 
| table extended_message, nombre&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Sample Search :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval raw="{message:AZK} x 10|{message:BCK} x 5|{message:C} x 3", raw=split(raw,"|") 
| mvexpand raw 
| rename raw as _raw 
|rename comment as "upto this is sample data" 
| rex field=_raw "message:(?&amp;lt;message&amp;gt;.*)}" 
| eval extended_message= case(
    match(_raw,"AZK"),"Message AZK",
    match(_raw,"BCK"),"Message BCK",
    1=1, message) 
| stats count as nombre by extended_message 
| sort nombre desc 
| table extended_message, nombre&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-01-17 at 11.54.47 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23407i7144C74C531607C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-01-17 at 11.54.47 PM.png" alt="Screenshot 2023-01-17 at 11.54.47 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this will help you.&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 18:25:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-achieve-eval-case-match/m-p/627380#M15125</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2023-01-17T18:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help with eval case match</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-achieve-eval-case-match/m-p/627386#M15128</link>
      <description>&lt;P&gt;I needed to use indeed a rex&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 19:36:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-achieve-eval-case-match/m-p/627386#M15128</guid>
      <dc:creator>maxouhunterfc</dc:creator>
      <dc:date>2023-01-17T19:36:01Z</dc:date>
    </item>
  </channel>
</rss>

