<?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 we execute a script that uses fields from a message? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-execute-a-script-that-uses-fields-from-a-message/m-p/327098#M60755</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="THIS JOB XXYYZZ" IS DOWN on server ABC"
| rex "JOB\s+(?&amp;lt;job&amp;gt;\S+)\s+IS\s+(?&amp;lt;state&amp;gt;\S+)\s+on\s+server\s+(?&amp;lt;server&amp;gt;\S+)"

| rename COMMENT AS "Everything above is generating sample event data; everything below is your solution"

| map search="| makeresults | YourScriptHere $job$ $server$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Dec 2017 23:28:24 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-12-04T23:28:24Z</dc:date>
    <item>
      <title>How can we execute a script that uses fields from a message?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-execute-a-script-that-uses-fields-from-a-message/m-p/327096#M60753</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;We usually get hundreds of logs and we want to execute scripts based on those logs. The key takeaway here is when Splunk scans a log file based on a message like "THIS JOB XXYYZZ" IS DOWN on server ABC" I want to execute a script passing XXYYZZ ABC as arguments.&lt;/P&gt;

&lt;P&gt;Note: JOB name and server name changes.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 21:03:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-execute-a-script-that-uses-fields-from-a-message/m-p/327096#M60753</guid>
      <dc:creator>thsvinayb4u</dc:creator>
      <dc:date>2017-12-04T21:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can we execute a script that uses fields from a message?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-execute-a-script-that-uses-fields-from-a-message/m-p/327097#M60754</link>
      <description>&lt;P&gt;Hi thsvinayb4u,&lt;/P&gt;

&lt;P&gt;you are looking for custom alert action; find the docs here &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/ModAlertsIntro"&gt;http://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/ModAlertsIntro&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;All you need to know about passing tokens to your alert script can be found here &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/ModAlertsLog"&gt;http://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/ModAlertsLog&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;Hope this helps to get you started ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 21:33:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-execute-a-script-that-uses-fields-from-a-message/m-p/327097#M60754</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-12-04T21:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can we execute a script that uses fields from a message?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-execute-a-script-that-uses-fields-from-a-message/m-p/327098#M60755</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="THIS JOB XXYYZZ" IS DOWN on server ABC"
| rex "JOB\s+(?&amp;lt;job&amp;gt;\S+)\s+IS\s+(?&amp;lt;state&amp;gt;\S+)\s+on\s+server\s+(?&amp;lt;server&amp;gt;\S+)"

| rename COMMENT AS "Everything above is generating sample event data; everything below is your solution"

| map search="| makeresults | YourScriptHere $job$ $server$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Dec 2017 23:28:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-execute-a-script-that-uses-fields-from-a-message/m-p/327098#M60755</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-04T23:28:24Z</dc:date>
    </item>
  </channel>
</rss>

