<?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: Return ExitCode Value in Alert/Event in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Return-ExitCode-Value-in-Alert-Event/m-p/143875#M2327</link>
    <description>&lt;P&gt;This should be pretty easy in Splunk - I don't think you need a script at all. You are monitoring &lt;CODE&gt;WMI:Service&lt;/CODE&gt; using Splunk. Therefore I assume that you have a field in the events named EventID or ExitCode. You could create a lookup table of the codes and then include that information as part of your search/alert.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=WMI:Service yourerrrortesthere 
| lookup exitcodeLookup ExitCode OUTPUT ExitMessage
| table ExitCode ExitMessage other_stuff_you_want_to_show
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There are lots of ways to do this. This example assumes that you have loaded a .csv file for the lookup like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ExitCode,ExitMessage
100,Bad Input
200,User Error
302,Unknown Result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you are talking about actual Windows Event Codes, there is a free Splunk app that will look them up for you: &lt;A href="http://apps.splunk.com/app/411/"&gt;http://apps.splunk.com/app/411/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Here is a tutorial on lookups: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.3/PivotTutorial/AddlookupfilestoSplunk"&gt;Add lookup files into Splunk&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Or download the free Splunk book: &lt;A href="http://www.splunk.com/goto/book"&gt;Exploring Splunk&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Apr 2014 04:04:28 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2014-04-29T04:04:28Z</dc:date>
    <item>
      <title>Return ExitCode Value in Alert/Event</title>
      <link>https://community.splunk.com/t5/Alerting/Return-ExitCode-Value-in-Alert-Event/m-p/143874#M2326</link>
      <description>&lt;P&gt;Currently monitoring some Windows and Application services via &lt;CODE&gt;WMI:Service&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;I have a list of known Windows Exit Codes for windows processes/services and I'd like to correlate the ExitCode to an Event or Alert when it is reported to users (because there are far too many codes and I don't know every instance that may be generated in the future).&lt;/P&gt;

&lt;P&gt;So let's say a service halts and my exit code is 1067, which means "The process terminated unexpectedly." I would like that value to be appended to my alert given the value of my exit code. &lt;/P&gt;

&lt;P&gt;Is there a more elegant solution than simply writing a script to look at the values of the alert (for when the service stops)? If not - do Splunk scripts support a stdin/stout like interface where I can return a value to the alert?&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2014 21:30:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Return-ExitCode-Value-in-Alert-Event/m-p/143874#M2326</guid>
      <dc:creator>confma812</dc:creator>
      <dc:date>2014-04-25T21:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Return ExitCode Value in Alert/Event</title>
      <link>https://community.splunk.com/t5/Alerting/Return-ExitCode-Value-in-Alert-Event/m-p/143875#M2327</link>
      <description>&lt;P&gt;This should be pretty easy in Splunk - I don't think you need a script at all. You are monitoring &lt;CODE&gt;WMI:Service&lt;/CODE&gt; using Splunk. Therefore I assume that you have a field in the events named EventID or ExitCode. You could create a lookup table of the codes and then include that information as part of your search/alert.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=WMI:Service yourerrrortesthere 
| lookup exitcodeLookup ExitCode OUTPUT ExitMessage
| table ExitCode ExitMessage other_stuff_you_want_to_show
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There are lots of ways to do this. This example assumes that you have loaded a .csv file for the lookup like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ExitCode,ExitMessage
100,Bad Input
200,User Error
302,Unknown Result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you are talking about actual Windows Event Codes, there is a free Splunk app that will look them up for you: &lt;A href="http://apps.splunk.com/app/411/"&gt;http://apps.splunk.com/app/411/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Here is a tutorial on lookups: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.3/PivotTutorial/AddlookupfilestoSplunk"&gt;Add lookup files into Splunk&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Or download the free Splunk book: &lt;A href="http://www.splunk.com/goto/book"&gt;Exploring Splunk&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2014 04:04:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Return-ExitCode-Value-in-Alert-Event/m-p/143875#M2327</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-04-29T04:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Return ExitCode Value in Alert/Event</title>
      <link>https://community.splunk.com/t5/Alerting/Return-ExitCode-Value-in-Alert-Event/m-p/143876#M2328</link>
      <description>&lt;P&gt;Oh excellent, I am always learning more on the features of Splunk. &lt;/P&gt;

&lt;P&gt;With regards to the Lookups as well as the app you suggested, will I be able to specify lookups only for when alerts are triggered, or in that case does it happen for every WMI:Service update interval?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2014 16:16:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Return-ExitCode-Value-in-Alert-Event/m-p/143876#M2328</guid>
      <dc:creator>confma812</dc:creator>
      <dc:date>2014-04-29T16:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Return ExitCode Value in Alert/Event</title>
      <link>https://community.splunk.com/t5/Alerting/Return-ExitCode-Value-in-Alert-Event/m-p/143877#M2329</link>
      <description>&lt;P&gt;You can use the &lt;CODE&gt;lookup&lt;/CODE&gt; command in any search string. If you make the lookups &lt;EM&gt;automatic&lt;/EM&gt;, you will not even need to specify the command - the fields from the lookup will always be available.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2014 19:33:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Return-ExitCode-Value-in-Alert-Event/m-p/143877#M2329</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-04-29T19:33:47Z</dc:date>
    </item>
  </channel>
</rss>

