<?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: How to group and count similar field values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-and-count-similar-field-values/m-p/491644#M137236</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="Servicename, msg
SVCA, hostnamexyz: AIX abc- asdf PARTIAL
SVCB, hostnamezyx: AIX abc- asdf PARTIAL
SVCA, hostnamezyx: AIX abc- asdf PARTIAL
SVCB, serice response error 3 of 3
SVCC, service response error of 3"
| multikv forceheader=1
| table Servicename, msg
| rex field=msg "(?&amp;lt;key&amp;gt;response error|hostname)"
| stats count values(msg) as msg by key , Servicename
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, The key is a match for a specific word, and it is tabulated.&lt;BR /&gt;
How about it?&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 12:57:30 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2019-11-20T12:57:30Z</dc:date>
    <item>
      <title>How to group and count similar field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-and-count-similar-field-values/m-p/491642#M137234</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Im looking for a way to group and count similar msg strings.&lt;BR /&gt;
I have the following set of data in an transaction combinded event:&lt;/P&gt;

&lt;P&gt;Servicename, msg&lt;BR /&gt;
SVCA, hostnamexyz: AIX abc- asdf   PARTIAL&lt;BR /&gt;
SVCB, hostnamezyx: AIX abc- asdf PARTIAL&lt;BR /&gt;
SVCA, hostnamezyx: AIX abc- asdf   PARTIAL&lt;BR /&gt;
SVCB, serice response error 3 of 3&lt;BR /&gt;
SVCC, service response error of 3&lt;/P&gt;

&lt;P&gt;What I would like to achive is a statistic like that:&lt;BR /&gt;
hostname*: AIX abc- asdf   PARTIAL - SVCA - 2&lt;BR /&gt;
hostname*: AIX abc- asdf   PARTIAL - SVCB - 1&lt;BR /&gt;
service response error of 3 - SVCB -1&lt;BR /&gt;
service response error of 3 - SVC -1&lt;/P&gt;

&lt;P&gt;The values of the msg field arent known and cannot be predicted.&lt;/P&gt;

&lt;P&gt;Is there any command/addon/performant way in SPL to do such a statistic based on some citeria like "at least 3 words in a field matching"?&lt;/P&gt;

&lt;P&gt;Many thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:06:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-and-count-similar-field-values/m-p/491642#M137234</guid>
      <dc:creator>martineisenkoel</dc:creator>
      <dc:date>2020-09-30T03:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to group and count similar field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-and-count-similar-field-values/m-p/491643#M137235</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;You will need to extract the relevant information you need in the &lt;CODE&gt;msg&lt;/CODE&gt; field. &lt;BR /&gt;
For example here&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval Servicename = "SVCA",msg = "hostnamexyz: AIX abc- asdf PARTIAL" 
| append 
    [| makeresults 
    | eval Servicename = "SVCB",msg = "hostnamezyx: AIX abc- asdf PARTIAL"] 
| append 
    [| makeresults 
    | eval Servicename = "SVCA",msg = "hostnamezyx: AIX abc- asdf PARTIAL"] 
| append 
    [| makeresults 
    | eval Servicename = "SVCB",msg = "service response error of 3"] 
| append 
    [| makeresults 
    | eval Servicename = "SVCC",msg = "service response error of 3"]
| table Servicename,msg
| rex field=msg "(?&amp;lt;newField&amp;gt;AIX.*PARTIAL)"
| eval newField = coalesce(newField,msg)
| stats count BY newField,Servicename
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See this working example with your sample of data.&lt;BR /&gt;
Let me know if it helps you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 12:56:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-and-count-similar-field-values/m-p/491643#M137235</guid>
      <dc:creator>KailA</dc:creator>
      <dc:date>2019-11-20T12:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to group and count similar field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-and-count-similar-field-values/m-p/491644#M137236</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="Servicename, msg
SVCA, hostnamexyz: AIX abc- asdf PARTIAL
SVCB, hostnamezyx: AIX abc- asdf PARTIAL
SVCA, hostnamezyx: AIX abc- asdf PARTIAL
SVCB, serice response error 3 of 3
SVCC, service response error of 3"
| multikv forceheader=1
| table Servicename, msg
| rex field=msg "(?&amp;lt;key&amp;gt;response error|hostname)"
| stats count values(msg) as msg by key , Servicename
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, The key is a match for a specific word, and it is tabulated.&lt;BR /&gt;
How about it?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 12:57:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-and-count-similar-field-values/m-p/491644#M137236</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-11-20T12:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to group and count similar field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-and-count-similar-field-values/m-p/491645#M137237</link>
      <description>&lt;P&gt;thanks a lot for your tips!&lt;BR /&gt;
Unfortunately I didnt phrase my question correctly.&lt;BR /&gt;
The problem is that I dont know whats in the msg field. The lines above are just anonymised examples. &lt;BR /&gt;
There are more than 500 different messages coming from various autonoumus monitoring systems where each individual admin could change a message any time.&lt;/P&gt;

&lt;P&gt;Our main goal is to identify similar messages/events which are affecting more than one service.&lt;BR /&gt;
For example similarity would mean to us at least 3 words are matching or 1 word matching and number of words are equal.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 07:31:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-and-count-similar-field-values/m-p/491645#M137237</guid>
      <dc:creator>martineisenkoel</dc:creator>
      <dc:date>2019-11-21T07:31:34Z</dc:date>
    </item>
  </channel>
</rss>

