<?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: truncating and merge values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366668#M108167</link>
    <description>&lt;P&gt;It strips off all trailing digits and the white space in front of it.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jun 2017 19:53:39 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-06-29T19:53:39Z</dc:date>
    <item>
      <title>truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366661#M108160</link>
      <description>&lt;P&gt;I have a bunch of log error descriptions that have unique IDs at the end of the sentences&lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
"CC declined. 123"     1&lt;BR /&gt;
"CC declined. 456"     1&lt;BR /&gt;
"Some error. 921"      1&lt;BR /&gt;
"Some error. 222"      1&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I want to truncate the rest of the numbers and merge the count so the result looks like&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;"CC decined"     2&lt;BR /&gt;
"Some error"      2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In addition, is there a way to automatically do this without stating every single instances that I want to truncate?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 18:32:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366661#M108160</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-29T18:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366662#M108161</link>
      <description>&lt;P&gt;Show us a diverse set of raw events and the separated out &lt;CODE&gt;description&lt;/CODE&gt; filed values.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 18:42:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366662#M108161</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-29T18:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366663#M108162</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;description         count
"CC declined. 123"     1
"CC declined. 456"     1
"Some error. 921"      1
"Some error. 222"      1
"Failed server 2"      1
"Failed server 12"     1
"CC declined. x12"     1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     description         count
"CC declined"     3
"Some error"      2
"Failed server"      2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I guess can we automatically truncate the string the moment we see any type of special character?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 18:56:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366663#M108162</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-29T18:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366664#M108163</link>
      <description>&lt;P&gt;try this, where &lt;CODE&gt;desc&lt;/CODE&gt; is the field name. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=desc "^(?&amp;lt;desc&amp;gt;(?i)[\w\s]+?)[^\w]?\s*\w?\d+$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The complication comes from that x12 at the end of one, with no special characters in it.&lt;/P&gt;

&lt;P&gt;Assumptions:  the last character of the description field will always be a number.   &lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 19:12:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366664#M108163</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-29T19:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366665#M108164</link>
      <description>&lt;P&gt;What about matching the first special character/non-word character?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 19:16:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366665#M108164</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-29T19:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366666#M108165</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval raw="CC declined. 123,1
CC declined. 456,1
Some error. 921,1
Some error. 222,1
Failed server 2,1
Failed server 12,1
CC declined. x12,1"
| makemv delim="
" raw
| mvexpand raw
| rename raw AS _raw
| rex "^(?&amp;lt;description&amp;gt;.*?),(?&amp;lt;count&amp;gt;\d+)$"
| table description count

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution."

| rex field=description mode=sed "s/\s+\d+$//"
| stats sum(count) AS count BY description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jun 2017 19:24:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366666#M108165</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-29T19:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366667#M108166</link>
      <description>&lt;P&gt;Seems like your regex matches whitespace then number, can i terminate the moment I see a period/any special characters&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 19:52:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366667#M108166</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-29T19:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366668#M108167</link>
      <description>&lt;P&gt;It strips off all trailing digits and the white space in front of it.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 19:53:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366668#M108167</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-29T19:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366669#M108168</link>
      <description>&lt;P&gt;Yes, but is there a pattern to strip the moment a special character is seen, strip the rest of the string. Or strip off starting from the special character too is fine&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 19:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366669#M108168</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-29T19:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366670#M108169</link>
      <description>&lt;P&gt;&lt;CODE&gt;| rex field=description "^(?&amp;lt;description&amp;gt;[^\r\.]+)"&lt;/CODE&gt; something like this, but for many special characters&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 20:11:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366670#M108169</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-29T20:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366671#M108170</link>
      <description>&lt;P&gt;I used &lt;CODE&gt;| rex field=description "^(?&amp;lt;description&amp;gt;[^\r\.]+)"&lt;/CODE&gt;, but I am getting "Unexpected closed tag"&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 20:17:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366671#M108170</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-29T20:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: truncating and merge values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366672#M108171</link>
      <description>&lt;P&gt;Yes, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=description mode=sed "s/[specialcharacterlisthere].*$//"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jun 2017 20:50:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/truncating-and-merge-values/m-p/366672#M108171</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-29T20:50:47Z</dc:date>
    </item>
  </channel>
</rss>

