<?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 can I create a field for error messages? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305687#M91750</link>
    <description>&lt;P&gt;You can do that using a  &lt;CODE&gt;rex&lt;/CODE&gt; command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search
| rex field=&amp;lt;your field&amp;gt; "\d+:\d+:\d+:\d+ (?P&amp;lt;triplet&amp;gt;.+)\((?P&amp;lt;app&amp;gt;.+)\) - (?P&amp;lt;error&amp;gt;.+) \((?P&amp;lt;message&amp;gt;.*)\)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will add the  &lt;CODE&gt;triplet&lt;/CODE&gt; field which corresponds to AAA or BBB in your example,  &lt;CODE&gt;app&lt;/CODE&gt; field that contains your "application name",  &lt;CODE&gt;error&lt;/CODE&gt; which will contain messages such as "No data found" and finally  &lt;CODE&gt;message&lt;/CODE&gt; that will contain the error message.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Aug 2017 12:34:04 GMT</pubDate>
    <dc:creator>fbehe</dc:creator>
    <dc:date>2017-08-30T12:34:04Z</dc:date>
    <item>
      <title>How can I create a field for error messages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305686#M91749</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;

&lt;P&gt;I am beginner of Splunk.&lt;/P&gt;

&lt;P&gt;I have a requirement like "we are having multiple applications in our system. When ever we see any errors transactions for any of the application. I have to fetch application name and error message into two different fields so that I can display it in table format."&lt;/P&gt;

&lt;P&gt;Could you please let me know how to fetch entire error message into a single field. Error message will not be same.&lt;/P&gt;

&lt;P&gt;Example Log:   2017:12:25:45 AAA(application name) - timeout error (error message)&lt;BR /&gt;
                         2017:12:25:49 BBB(application name) - Please enter correct details (error message)&lt;BR /&gt;
                         2017:12:25:45 AAA(application name) - No data found (error message)&lt;BR /&gt;
Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 12:26:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305686#M91749</guid>
      <dc:creator>123Janardhan</dc:creator>
      <dc:date>2017-08-30T12:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a field for error messages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305687#M91750</link>
      <description>&lt;P&gt;You can do that using a  &lt;CODE&gt;rex&lt;/CODE&gt; command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search
| rex field=&amp;lt;your field&amp;gt; "\d+:\d+:\d+:\d+ (?P&amp;lt;triplet&amp;gt;.+)\((?P&amp;lt;app&amp;gt;.+)\) - (?P&amp;lt;error&amp;gt;.+) \((?P&amp;lt;message&amp;gt;.*)\)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will add the  &lt;CODE&gt;triplet&lt;/CODE&gt; field which corresponds to AAA or BBB in your example,  &lt;CODE&gt;app&lt;/CODE&gt; field that contains your "application name",  &lt;CODE&gt;error&lt;/CODE&gt; which will contain messages such as "No data found" and finally  &lt;CODE&gt;message&lt;/CODE&gt; that will contain the error message.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 12:34:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305687#M91750</guid>
      <dc:creator>fbehe</dc:creator>
      <dc:date>2017-08-30T12:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a field for error messages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305688#M91751</link>
      <description>&lt;P&gt;You can do in the search with rex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\((?&amp;lt;appName&amp;gt;.*)\).+\((?&amp;lt;errorMessage&amp;gt;.*)\)" | table appName errorMessage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or you can do so via props.conf on the search heads:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetypeName]
EXTRACT-appNameErrorMessage = \((?&amp;lt;appName&amp;gt;.*)\).+\((?&amp;lt;errorMessage&amp;gt;.*)\)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2017 12:36:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305688#M91751</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-30T12:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a field for error messages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305689#M91752</link>
      <description>&lt;P&gt;Do i need to pass explicitly appName and errormessage. Is it not possible to get from events. Because we are having different types of error messages for the same application.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 12:50:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305689#M91752</guid>
      <dc:creator>123Janardhan</dc:creator>
      <dc:date>2017-08-30T12:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a field for error messages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305690#M91753</link>
      <description>&lt;P&gt;That will be the field name that contains a value that IS your application name or error message.  &lt;/P&gt;

&lt;P&gt;You can change it to whatever you want your field names to be:&lt;/P&gt;

&lt;P&gt;Run it against your data and look at the interesting fields on the left side of your screen.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 00:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305690#M91753</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-31T00:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a field for error messages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305691#M91754</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; | rex "\((?&amp;lt;field1&amp;gt;.*)\).+\((?&amp;lt;field2&amp;gt;.*)\)" | table field1 field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above would creat two fields, field1 and field2.  Field1 would be your application names and field2 would be your error messages.&lt;/P&gt;

&lt;P&gt;Now you can have fun with your new fields.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\((?&amp;lt;appName&amp;gt;.*)\).+\((?&amp;lt;errorMessage&amp;gt;.*)\)" | stats values(errorMessage) by appName

 | rex "\((?&amp;lt;appName&amp;gt;.*)\).+\((?&amp;lt;errorMessage&amp;gt;.*)\)" | stats count by errorMessage, appName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Etc&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 01:05:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305691#M91754</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-31T01:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a field for error messages?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305692#M91755</link>
      <description>&lt;P&gt;If you're saying AAA is the app name and "timeout error" is the error message then this could be your regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\d{4}:\d\d:\d\d:\d\d\s+(?&amp;lt;application&amp;gt;.*)\s-\s(?&amp;lt;error&amp;gt;.*)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Aug 2017 07:39:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-a-field-for-error-messages/m-p/305692#M91755</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-08-31T07:39:20Z</dc:date>
    </item>
  </channel>
</rss>

