<?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: Extract custom parameters for Custom alert action alerts in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Extract-custom-parameters-for-Custom-alert-action-alerts/m-p/435845#M7601</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you please let us know whether you would like to fetch host, source and sourcetype from Splunk Query output ? &lt;/P&gt;</description>
    <pubDate>Wed, 01 May 2019 11:55:46 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2019-05-01T11:55:46Z</dc:date>
    <item>
      <title>Extract custom parameters for Custom alert action alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Extract-custom-parameters-for-Custom-alert-action-alerts/m-p/435844#M7600</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I see that we can add various variables by default in the script for custom alert action like search term, trigger reason etc. &lt;BR /&gt;
How can we add custom parameters from the alert link like the hostname, source or sourcetype etc. and use them in the script.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 19:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extract-custom-parameters-for-Custom-alert-action-alerts/m-p/435844#M7600</guid>
      <dc:creator>pdantuuri0411</dc:creator>
      <dc:date>2019-04-30T19:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extract custom parameters for Custom alert action alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Extract-custom-parameters-for-Custom-alert-action-alerts/m-p/435845#M7601</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you please let us know whether you would like to fetch host, source and sourcetype from Splunk Query output ? &lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 11:55:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extract-custom-parameters-for-Custom-alert-action-alerts/m-p/435845#M7601</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-05-01T11:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extract custom parameters for Custom alert action alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Extract-custom-parameters-for-Custom-alert-action-alerts/m-p/435846#M7602</link>
      <description>&lt;P&gt;Yes. That is correct. The output from the alert has the fields host, source and sourcetype which I want to use for creating a custom alert action.&lt;/P&gt;

&lt;P&gt;Right now I am exporting a csv file with the result and created a script to check the file for the required info. Is this the best option or do we have anyother options?&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 17:13:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extract-custom-parameters-for-Custom-alert-action-alerts/m-p/435846#M7602</guid>
      <dc:creator>pdantuuri0411</dc:creator>
      <dc:date>2019-05-01T17:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Extract custom parameters for Custom alert action alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Extract-custom-parameters-for-Custom-alert-action-alerts/m-p/435847#M7603</link>
      <description>&lt;P&gt;You can create script in bash or python and read &lt;CODE&gt;payload&lt;/CODE&gt; value, in payload value you will able to find path for &lt;CODE&gt;results.csv.gz&lt;/CODE&gt; and in this file output is stored when splunk query ran. If you are writing script in bash then you can read result using &lt;CODE&gt;zcat&lt;/CODE&gt; command from this compressed results file and then use &lt;CODE&gt;for&lt;/CODE&gt; loop to read each and every events and perform necessary action as per your requirement.&lt;/P&gt;

&lt;P&gt;On this &lt;A href="https://answers.splunk.com/answers/734938/custom-alerts-how-to-use-configured-variables-and-1.html#answer-734324"&gt;https://answers.splunk.com/answers/734938/custom-alerts-how-to-use-configured-variables-and-1.html#answer-734324&lt;/A&gt; answer thread, I have provided part of &lt;STRONG&gt;bash script&lt;/STRONG&gt; to read payload and extract results.csv.gz path.&lt;/P&gt;

&lt;P&gt;If you want to write script in python then have a look at example here &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.6/AdvancedDev/ModAlertsBasicExample"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.6/AdvancedDev/ModAlertsBasicExample&lt;/A&gt; and once you have results.csv.gz absolute directory path then you need to use &lt;CODE&gt;for&lt;/CODE&gt; loop to perform necessary action on each event based on your requirement.&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 18:14:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extract-custom-parameters-for-Custom-alert-action-alerts/m-p/435847#M7603</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-05-01T18:14:50Z</dc:date>
    </item>
  </channel>
</rss>

