<?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 Custom alerts logs don't appear in internal index in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Custom-alerts-logs-don-t-appear-in-internal-index/m-p/384870#M69182</link>
    <description>&lt;P&gt;I don't see my custom alert action's logs as the documentation suggests I should.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import sys

# splat
# Run with arbitrary input, e.g., index=_internal | head 1 | sendalert splat

if __name__ == '__main__':
  print &amp;gt;&amp;gt;sys.stderr, "WARN splat look for me in the logs!"
  sys.exit(2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;According to &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.5/AdvancedDev/ModAlertsLog"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.5/AdvancedDev/ModAlertsLog&lt;/A&gt; :&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Access alert action script logs&lt;BR /&gt;
[....] Any information that your script prints to STDERR will be treated as a log message. Message&lt;BR /&gt;
prefixes, such as DEBUG, INFO, WARN, or ERROR, are treated as the log level. To review logs for an alert&lt;BR /&gt;
action, select &lt;STRONG&gt;Settings&amp;gt;Alert actions&lt;/STRONG&gt;.&lt;BR /&gt;
This takes you to the Alert Actions manager page. Select &lt;STRONG&gt;View log events&lt;/STRONG&gt; for your alert action.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;When I run the above custom alert, I see nothing in the internal index.  I &lt;EM&gt;do&lt;/EM&gt; see its logs in &lt;CODE&gt;search.log&lt;/CODE&gt; if it exits non-zero, of course, but I'd like to be able to see them from the &lt;EM&gt;View log events&lt;/EM&gt; link.&lt;/P&gt;

&lt;P&gt;How can I see that WARN log line in &lt;EM&gt;View log events&lt;/EM&gt; (viz., &lt;CODE&gt;index=_internal sourcetype=splunkd component=sendmodalert action="splat"&lt;/CODE&gt;) as the documentation suggests I ought to?&lt;/P&gt;</description>
    <pubDate>Fri, 29 Mar 2019 14:59:48 GMT</pubDate>
    <dc:creator>diletoan</dc:creator>
    <dc:date>2019-03-29T14:59:48Z</dc:date>
    <item>
      <title>Custom alerts logs don't appear in internal index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Custom-alerts-logs-don-t-appear-in-internal-index/m-p/384870#M69182</link>
      <description>&lt;P&gt;I don't see my custom alert action's logs as the documentation suggests I should.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import sys

# splat
# Run with arbitrary input, e.g., index=_internal | head 1 | sendalert splat

if __name__ == '__main__':
  print &amp;gt;&amp;gt;sys.stderr, "WARN splat look for me in the logs!"
  sys.exit(2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;According to &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.5/AdvancedDev/ModAlertsLog"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.5/AdvancedDev/ModAlertsLog&lt;/A&gt; :&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Access alert action script logs&lt;BR /&gt;
[....] Any information that your script prints to STDERR will be treated as a log message. Message&lt;BR /&gt;
prefixes, such as DEBUG, INFO, WARN, or ERROR, are treated as the log level. To review logs for an alert&lt;BR /&gt;
action, select &lt;STRONG&gt;Settings&amp;gt;Alert actions&lt;/STRONG&gt;.&lt;BR /&gt;
This takes you to the Alert Actions manager page. Select &lt;STRONG&gt;View log events&lt;/STRONG&gt; for your alert action.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;When I run the above custom alert, I see nothing in the internal index.  I &lt;EM&gt;do&lt;/EM&gt; see its logs in &lt;CODE&gt;search.log&lt;/CODE&gt; if it exits non-zero, of course, but I'd like to be able to see them from the &lt;EM&gt;View log events&lt;/EM&gt; link.&lt;/P&gt;

&lt;P&gt;How can I see that WARN log line in &lt;EM&gt;View log events&lt;/EM&gt; (viz., &lt;CODE&gt;index=_internal sourcetype=splunkd component=sendmodalert action="splat"&lt;/CODE&gt;) as the documentation suggests I ought to?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2019 14:59:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Custom-alerts-logs-don-t-appear-in-internal-index/m-p/384870#M69182</guid>
      <dc:creator>diletoan</dc:creator>
      <dc:date>2019-03-29T14:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Custom alerts logs don't appear in internal index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Custom-alerts-logs-don-t-appear-in-internal-index/m-p/384871#M69183</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Instead of &lt;CODE&gt;if name == 'main':&lt;/CODE&gt;, can you please run simple script without that if condition ? Have a look at sample example script on doc &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.5/AdvancedDev/ModAlertsBasicExample"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.5/AdvancedDev/ModAlertsBasicExample&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 08:21:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Custom-alerts-logs-don-t-appear-in-internal-index/m-p/384871#M69183</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-04-01T08:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Custom alerts logs don't appear in internal index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Custom-alerts-logs-don-t-appear-in-internal-index/m-p/384872#M69184</link>
      <description>&lt;P&gt;@harsmarvania57 , thanks.  &lt;CODE&gt;'main'&lt;/CODE&gt; was a formatting error of course.  I could not persuade the indented code block to be formatted correctly, so I moved it.  See again.  I can try your simpler example, but it's not germane:  I know that the script runs, and that &lt;CODE&gt;if&lt;/CODE&gt; stanza is good python and in most other splunk docs (e.g., the HipChat handler in those docs).  I just don't know where the output goes.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 11:59:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Custom-alerts-logs-don-t-appear-in-internal-index/m-p/384872#M69184</guid>
      <dc:creator>diletoan</dc:creator>
      <dc:date>2019-04-01T11:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Custom alerts logs don't appear in internal index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Custom-alerts-logs-don-t-appear-in-internal-index/m-p/384873#M69185</link>
      <description>&lt;P&gt;The explanation appears to be that the stderr logs &lt;EM&gt;are&lt;/EM&gt; properly captured to the internal index when a &lt;EM&gt;bona fide&lt;/EM&gt; alert is configured (&lt;STRONG&gt;Searches, Reports, and Alerts&lt;/STRONG&gt;).&lt;/P&gt;

&lt;P&gt;However, they &lt;EM&gt;are not&lt;/EM&gt; captured when the same custom alert is run by hand using &lt;CODE&gt;sendalert my_custom_alert&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;That's unexpected behavior, I'd say, but so it is.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 15:44:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Custom-alerts-logs-don-t-appear-in-internal-index/m-p/384873#M69185</guid>
      <dc:creator>diletoan</dc:creator>
      <dc:date>2019-04-01T15:44:09Z</dc:date>
    </item>
  </channel>
</rss>

