<?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 sort different error strings in one log file? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187906#M54157</link>
    <description>&lt;P&gt;Can we consider the following as error messages&lt;BR /&gt;
Unexpected error com.eMeter.PIPe.datatransferservice.exception.DTSRuntimeException&lt;BR /&gt;
Invalid date. java.lang.NullPointerException&lt;BR /&gt;
SDP lookup failed [null]&lt;/P&gt;

&lt;P&gt;Means, all error messages start after -&lt;SPACE&gt; and end before :&lt;/SPACE&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Aug 2014 08:41:38 GMT</pubDate>
    <dc:creator>strive</dc:creator>
    <dc:date>2014-08-20T08:41:38Z</dc:date>
    <item>
      <title>How to sort different error strings in one log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187905#M54156</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I'm currently importing log-files into Splunk, to monitor the different kind of Errors that passes through the system that are monitored.&lt;BR /&gt;
Up to now I've only searched for the string 'ERROR' in each log file. Since a log file may contain many different kind of errors, the result is that many kind of Errors are presented together. I would like to sort/group the different kind of errors in one diagram.&lt;/P&gt;

&lt;P&gt;The search as today is as follows (for one of the log-files)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ERROR source="/home/logs/DataTransferService.log"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result would then consist of many different ERROR messages, similar to these three (as an example):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2014-08-19 12:00:00,394 [pool-1-thread-1] ERROR - Unexpected error com.eMeter.PIPe.datatransferservice.exception.DTSRuntimeException:…

2014-08-19 11:20:01,815 [pool-1-thread-4] ERROR - Invalid date. java.lang.NullPointerException:…

2014-08-19 11:20:01,814 [pool-1-thread-4] ERROR - SDP lookup failed [null]: id to load is required for loading [Additional Information:…
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Aug 2014 07:07:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187905#M54156</guid>
      <dc:creator>Bergans</dc:creator>
      <dc:date>2014-08-20T07:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort different error strings in one log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187906#M54157</link>
      <description>&lt;P&gt;Can we consider the following as error messages&lt;BR /&gt;
Unexpected error com.eMeter.PIPe.datatransferservice.exception.DTSRuntimeException&lt;BR /&gt;
Invalid date. java.lang.NullPointerException&lt;BR /&gt;
SDP lookup failed [null]&lt;/P&gt;

&lt;P&gt;Means, all error messages start after -&lt;SPACE&gt; and end before :&lt;/SPACE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2014 08:41:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187906#M54157</guid>
      <dc:creator>strive</dc:creator>
      <dc:date>2014-08-20T08:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort different error strings in one log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187907#M54158</link>
      <description>&lt;P&gt;Well, it's not entirely clear what you want to achieve. Sorting and grouping is usually performed on &lt;CODE&gt;fields&lt;/CODE&gt;. Say that you want to group all errors on the type of error ("Unexpected error", "Invalid date" or "SDP lookup failed" in your example), you need to extract this part of the message as a field (let's call it &lt;CODE&gt;errType&lt;/CODE&gt;) and whatever comes after it is extracted as &lt;CODE&gt;errMsg&lt;/CODE&gt;. This can be done in config files or inline in the search query. We'll do the latter here. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ERROR source="/home/logs/DataTransferService.log" 
| rex "\sERROR\s-\s(?&amp;lt;errType&amp;gt;[^\.\r\n:]+)(?&amp;lt;errMsg&amp;gt;.*)"
| eval niceTime = strftime(_time, "%F %T")
| stats list(niceTime) list(errMsg) by errType
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should result in an output like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Unexpected Error        2014-06-20 11:22:23     com.eMeter.PIPe.datatransferblahblahblahb
                        2014-06-21 12:23:34     some.other.errormessage
Invalid date            2014-06-23 22:32:21     Blah Blah Blah error
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and so forth. Maybe something like that is what you're looking for? &lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2014 08:48:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187907#M54158</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2014-08-20T08:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort different error strings in one log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187908#M54159</link>
      <description>&lt;P&gt;No, the Errors may be identified by 'ERROR - '*&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2014 09:52:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187908#M54159</guid>
      <dc:creator>Bergans</dc:creator>
      <dc:date>2014-08-20T09:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort different error strings in one log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187909#M54160</link>
      <description>&lt;P&gt;Thanks a lot @kristian.kolb,&lt;BR /&gt;
I see that I was a bit unclear about what really wanted to achieve. I changed your last part: &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;| stats list(niceTime) list(errMsg) by errType"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;with:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;| timechart span=1d count by errType usenull=f&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Then I got exactly what I needed.&lt;BR /&gt;
Now I got a sorted list of the different kind of errors, and a visualized graphical view.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2014 10:33:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187909#M54160</guid>
      <dc:creator>Bergans</dc:creator>
      <dc:date>2014-08-20T10:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort different error strings in one log file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187910#M54161</link>
      <description>&lt;P&gt;btw, if you're NOT doing the &lt;CODE&gt;stats list(niceTime)&lt;/CODE&gt; part, you can skip the preceding &lt;CODE&gt;eval niceTime strftime(_time, "%F %T")&lt;/CODE&gt; as well.&lt;/P&gt;

&lt;P&gt;EDIT : missing "NOT"&lt;BR /&gt;
/k&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2014 12:10:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-different-error-strings-in-one-log-file/m-p/187910#M54161</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2014-08-20T12:10:50Z</dc:date>
    </item>
  </channel>
</rss>

