<?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: Can't get value of job.resultCount when using Custom Alert Action in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326278#M60652</link>
    <description>&lt;P&gt;Yes, It is Linux.&lt;/P&gt;

&lt;P&gt;Let me try Windows/Powershell combo.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Oct 2017 11:22:15 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2017-10-27T11:22:15Z</dc:date>
    <item>
      <title>Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326263#M60637</link>
      <description>&lt;H4&gt;How the alert is defined&lt;/H4&gt;

&lt;P&gt;I have created a custom alert action after following documentation found here &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.6.0/AdvancedDev/ModAlertsIntro"&gt;http://docs.splunk.com/Documentation/Splunk/6.6.0/AdvancedDev/ModAlertsIntro&lt;/A&gt;, my alert is defined like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[nimsoft]
is_custom = 1
label = Nimsoft Custom Alert Action
icon_path = action.png
payload_format = json
disabled = 0
alert.execute.cmd = powershell.path
alert.execute.cmd.arg.0 = -NoProfile
alert.execute.cmd.arg.1 = -f
alert.execute.cmd.arg.2 = $SPLUNK_HOME\etc\apps\klp_nimsoft_custom_alerts\bin\testArguments.ps1
alert.execute.cmd.arg.3 = --execute
param.result_count = $job.resultCount$
param.search_query = $job.search$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H4&gt;Problem description&lt;/H4&gt;

&lt;P&gt;The above alert is working almost just fine. Using Powershell I am able to get hold of both the payload and the command line arguments, script output is like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[10/19/2017 8:23 AM]: Now loop all arguments
[10/19/2017 8:23 AM]: Arg 0: --execute
[10/19/2017 8:23 AM]: Settings are: @{app=klp_nimsoft_custom_alerts; owner=admin; results_file=D:\splunk\var\run\splunk\dispatch\scheduler__admin_...__TestAlarm_at_1508394180_23089\per_result_alert\tmp_24.csv.gz; results_link=http://SplunkSearch:80/app/klp_nimsoft_custom_alerts/search?q=%7Cloadjob%20scheduler__admin_....w__TestAlarm_at_....&amp;amp;earliest=0&amp;amp;latest=now; search_uri=/servicesNS/nobody/klp_nimsoft_custom_alerts/saved/searches/TestAlarm; server_host=SPLUNKSEARCH; server_uri=https://127.0.0.1:8089; session_key=iwb0t_....; sid=scheduler__admin_...__TestAlarm_at_1508394180_23089; search_name=TestAlarm; configuration=; result=}
[10/19/2017 8:23 AM]: All done
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But problem is that in order to really do the magic I need to to with the proper script, I need to know the number of events found by the alert, that is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  param.result_count = $job.resultCount$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the value is nowhere to be found, at least it can be found where I expect it to be found, so maybe I need to look into other places. Anyone able to see what's wrong here?&lt;/P&gt;

&lt;H4&gt;The Powershell script testArguments.ps1&lt;/H4&gt;

&lt;P&gt;It might be that someone is curious about how the script looks like as well, so here goes&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;#
.Synopsis
Script used to verify Splunk alerts, write to a log file both command line argumenst and stdin (payload)

.Description
Powershell -File "D:\Splunk\etc\apps\klp_nimsoft_custom_alerts\bin\testArguments.ps1"

#&amp;gt;


&amp;lt;#
    Get current timestamp, used when writing to logfile
#&amp;gt;
function Get-TimeStamp {

    $timeStamp = "[" + (Get-Date).ToShortDateString() + " " + ((Get-Date).ToShortTimeString()) + "]"

    Return $timeStamp

}

# The logfile
$fileName = "d:\temp\arguments_test_updated.log"

# If exist, remove
If (Test-Path $fileName) {
    Remove-Item $fileName
}

# Start printing all argv's
$msg = (Get-TimeStamp) + ": Now loop all arguments"
write-host  $msg
Add-Content $fileName $msg
for ( $i = 0; $i -lt $args.count; $i++ ) {
    $msg = (Get-TimeStamp) + ": Arg $($i): $($args[$i])"
    write-host $msg
    Add-Content $fileName $msg

}

# Print stdin
# &lt;A href="https://stackoverflow.com/questions/44695956/what-is-powershells-equivalent-to-pythons-sys-stdin-read" target="test_blank"&gt;https://stackoverflow.com/questions/44695956/what-is-powershells-equivalent-to-pythons-sys-stdin-read&lt;/A&gt;
$settings = $input | Out-String | ConvertFrom-Json
$msg = (Get-TimeStamp) + ": Settings are: " + $settings
write-host $msg
Add-Content $fileName $msg
$msg = (Get-TimeStamp) +  ": All done"
Write-Host $msg
Add-Content $fileName $msg
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Oct 2017 06:10:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326263#M60637</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2017-10-25T06:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326264#M60638</link>
      <description>&lt;P&gt;Hi @rune.hellem,&lt;/P&gt;

&lt;P&gt;It looks like you are not getting &lt;CODE&gt;param.result_count&lt;/CODE&gt; and &lt;CODE&gt;param.search_query&lt;/CODE&gt; result in your payload, those value should come after &lt;CODE&gt;configuration=&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;You can do one thing try to create spec file in &lt;CODE&gt;$SPLUNK_HOME/etc/apps/&amp;lt;CUSTOM ALERT APP&amp;gt;/README/alert_actions.conf.spec&lt;/CODE&gt; with below content&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[nimsoft]

param.result_count = &amp;lt;integer&amp;gt;
* Runtime value of result count.

param.search_query = &amp;lt;string&amp;gt;
* Runtime splunk search query.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Oct 2017 09:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326264#M60638</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-10-25T09:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326265#M60639</link>
      <description>&lt;P&gt;I did create file &lt;CODE&gt;D:\splunk\etc\apps\klp_nimsoft_custom_alerts\README\alert_actions.conf.spec&lt;/CODE&gt; with content&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[nimsoft]
# Runtime value of result count. 
param.result_count = &amp;lt;integer&amp;gt;

# Runtime splunk search query. 
param.search_query = &amp;lt;string&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then first attempt, just did a refresh &lt;A href="http://.../debug/refresh" target="test_blank"&gt;http://.../debug/refresh&lt;/A&gt;, did not help. Then restarted, still same, output is still&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...search_name=TestAlarm; configuration=; result=}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Oct 2017 07:56:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326265#M60639</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2017-10-26T07:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326266#M60640</link>
      <description>&lt;P&gt;What is your splunk query and when you run it manually, are you getting any results ? Based on your payload &lt;CODE&gt;results.csv.gz&lt;/CODE&gt; file is generating but you are not getting any value after &lt;CODE&gt;result=&lt;/CODE&gt;, that is quite strange.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 08:08:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326266#M60640</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-10-26T08:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326267#M60641</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Have tried to pass hardcode value in conf file??&lt;/P&gt;

&lt;P&gt;like..&lt;BR /&gt;
param.result_count = 100&lt;BR /&gt;
param.search_query = | stats count&lt;/P&gt;

&lt;P&gt;Does payload populate as expected?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:28:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326267#M60641</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-09-29T16:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326268#M60642</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=*prod error
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It would have been nice to be able to say that the above search string does not return results...but...it does &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 09:14:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326268#M60642</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2017-10-26T09:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326269#M60643</link>
      <description>&lt;P&gt;Did just now try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;param.result_count = 67
param.search_query = | stats count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First /debug/refresh, then restart. Still&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; search_name=TestAlarm; configuration=; result=}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To be all sure, did search for &lt;EM&gt;result_count&lt;/EM&gt; in all files in folder &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;D:\splunk\var\run\splunk\dispatch\scheduler__admin_a2xwX25pbXNvZnRfY3VzdG9tX2FsZXJ0cw__TestAlarm_at_1509009960_21
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Found nothing. Did also check the results.csv.gz and it does have results. &lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 09:39:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326269#M60643</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2017-10-26T09:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326270#M60644</link>
      <description>&lt;P&gt;can you share your savedsearch.conf configuration for this particular alert?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 09:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326270#M60644</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-26T09:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326271#M60645</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;[TestAlarm]
action.email.useNSSubject = 1
action.logevent = 1
action.logevent.param.event = nimsoftCustomAlert=true antall=$result.count$ antallJob=$job.resultCount$
action.logevent.param.host = splunksearch
action.logevent.param.index = filenetprod
action.nimsoft = 1
action.nimsoft_100_filenet_error = 1
alert.digest_mode = 0
alert.suppress = 0
alert.track = 0
counttype = number of events
cron_schedule = * * * * *
dispatch.earliest_time = -2m
dispatch.latest_time = now
enableSched = 1
quantity = 0
relation = greater than
request.ui_dispatch_app = klp_nimsoft_custom_alerts
request.ui_dispatch_view = search
search = index=filenetprod error
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The action logevent creates an event of type generic_single_line which is logged like this&lt;BR /&gt;
    nimsoftCustomAlert=true antall= antallJob=44&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:29:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326271#M60645</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2020-09-29T16:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326272#M60646</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;can please add below two entry in &lt;CODE&gt;[TestAlarm]&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;action.nimsoft.param.result_count = $job.resultCount$
action.nimsoft.param.search_query = $job.search$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Meanwhile can you please check any error during executing of search? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal component=SavedSplunker savedsearch_name="TestAlarm"

index=_internal component=script command=runshellscript
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Oct 2017 12:31:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326272#M60646</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-26T12:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326273#M60647</link>
      <description>&lt;P&gt;Hmm, hard nail this one...&lt;/P&gt;

&lt;P&gt;Did add to savesearches.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;action.nimsoft.param.result_count = $job.resultCount$
action.nimsoft.param.search_query = $job.search$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Restarted Splunk, still same &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...search_name=TestAlarm; configuration=; result=}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Checking internal log, only info messages&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10-26-2017 14:49:29.685 +0200 INFO  SavedSplunker - savedsearch_id="nobody;klp_nimsoft_custom_alerts;TestAlarm", search_type="scheduled", user="admin", app="klp_nimsoft_custom_alerts", savedsearch_name="TestAlarm", priority=default, status=success, digest_mode=0, scheduled_time=1509022140, window_time=0, dispatch_time=1509022141, run_time=0.875, result_count=23, alert_actions="logevent,nimsoft", sid="scheduler__admin_a2xwX25pbXNvZnRfY3VzdG9tX2FsZXJ0cw__TestAlarm_at_1509022140_14", suppressed=0, fired=23, skipped=0, action_time_ms=26641, thread_id="AlertNotifierWorker-0", message=""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal component=ScriptRunner
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;actually does return &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10-26-2017 14:45:54.463 +0200 ERROR ScriptRunner - Couldn't start child process. script="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -f D:\splunk\etc\apps\klp_nimsoft_custom_alerts\bin\testArguments.ps1 --execute"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it seems to be a false positive, since the log file is being updated.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 12:56:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326273#M60647</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2017-10-26T12:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326274#M60648</link>
      <description>&lt;P&gt;mmm,&lt;/P&gt;

&lt;P&gt;Is below is another alert action or something in &lt;CODE&gt;[TestAlarm]&lt;/CODE&gt; ?? Can we comment It?&lt;BR /&gt;
like..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#action.nimsoft_100_filenet_error = 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Apart from it, can we validate configuration by executing btool command??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SPLUNK_PATH/bin/splunk btool check
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Oct 2017 13:10:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326274#M60648</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-26T13:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326275#M60649</link>
      <description>&lt;P&gt;Did clean up the alert, now it is defined like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[TestAlarm]
action.email.useNSSubject = 1
action.nimsoft = 1
action.nimsoft.param.result_count = $job.resultCount$
action.nimsoft.param.search_query = $job.search$
alert.digest_mode = 0
alert.suppress = 0
alert.track = 0
counttype = number of events
cron_schedule = * * * * *
dispatch.earliest_time = -2m
dispatch.latest_time = now
enableSched = 1
quantity = 0
relation = greater than
request.ui_dispatch_app = klp_nimsoft_custom_alerts
request.ui_dispatch_view = search
search = index=filenetprod error
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Restarted the server to be all sure, but still no help. Nothing in configuration yet. &lt;BR /&gt;
    Splunk btool check &lt;BR /&gt;
does not show any issuew with the app. &lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 13:58:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326275#M60649</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2017-10-26T13:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326276#M60650</link>
      <description>&lt;P&gt;Strange!!&lt;/P&gt;

&lt;P&gt;On my instance, it's working .. &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Can you please confirm below files structure are available??&lt;/P&gt;

&lt;P&gt;[app_name]&lt;BR /&gt;
    bin&lt;BR /&gt;
        [custom_alert_action_script]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;default
    alert_actions.conf
    app.conf
    data
        ui
            alerts
                [custom_alert_action].html

README
    alert_actions.conf.spec
    savedsearches.conf.spec
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can we call python script for testing ??&lt;/P&gt;

&lt;P&gt;python code (nimsoft.py):&lt;/P&gt;

&lt;P&gt;import sys, os, datetime&lt;/P&gt;

&lt;P&gt;def log(msg):&lt;BR /&gt;
    f = open(os.path.join(os.environ["SPLUNK_HOME"], "var", "log", "splunk", "test_modalert.log"), "a")&lt;BR /&gt;
    print &amp;gt;&amp;gt; f, str(datetime.datetime.now().isoformat()), msg&lt;BR /&gt;
    f.close()&lt;/P&gt;

&lt;P&gt;log("got arguments %s" % sys.argv)&lt;BR /&gt;
log("got payload: %s" % sys.stdin.read())&lt;/P&gt;

&lt;P&gt;print &amp;gt;&amp;gt;sys.stderr, "INFO Hello STDERR"&lt;/P&gt;

&lt;P&gt;We are just logging.&lt;/P&gt;

&lt;P&gt;log should contain like...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;stanza name="AlertName"&amp;gt;
  &amp;lt;param name="result_count"&amp;gt;27&amp;lt;/param&amp;gt;
  &amp;lt;param name="search_query"&amp;gt;search index="_internal" | stats count by sourcetype&amp;lt;/param&amp;gt;
&amp;lt;/stanza&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:30:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326276#M60650</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-09-29T16:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326277#M60651</link>
      <description>&lt;P&gt;Folder structure with files&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;apps\klp_nimsoft_custom_alerts\appserver
apps\klp_nimsoft_custom_alerts\appserver\static
apps\klp_nimsoft_custom_alerts\appserver\static\action.png

apps\klp_nimsoft_custom_alerts\bin
apps\klp_nimsoft_custom_alerts\bin\powershell.path
apps\klp_nimsoft_custom_alerts\bin\README
apps\klp_nimsoft_custom_alerts\bin\scripts
apps\klp_nimsoft_custom_alerts\bin\scripts\testArguments.ps1

apps\klp_nimsoft_custom_alerts\default
apps\klp_nimsoft_custom_alerts\default\alert_actions.conf
apps\klp_nimsoft_custom_alerts\default\app.conf
apps\klp_nimsoft_custom_alerts\default\data
apps\klp_nimsoft_custom_alerts\default\data\ui
apps\klp_nimsoft_custom_alerts\default\data\ui\nav
apps\klp_nimsoft_custom_alerts\default\data\ui\views
apps\klp_nimsoft_custom_alerts\default\data\ui\nav\default.xml
apps\klp_nimsoft_custom_alerts\default\data\ui\views\README

apps\klp_nimsoft_custom_alerts\local
apps\klp_nimsoft_custom_alerts\local\app.conf
apps\klp_nimsoft_custom_alerts\local\savedsearches.conf

apps\klp_nimsoft_custom_alerts\metadata
apps\klp_nimsoft_custom_alerts\metadata\default.meta
apps\klp_nimsoft_custom_alerts\metadata\local.meta

apps\klp_nimsoft_custom_alerts\README
apps\klp_nimsoft_custom_alerts\README\alert_actions.conf.spec
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I do not have the savedsearches.conf.spec.&lt;/P&gt;

&lt;P&gt;I do not have Python installed on the server so I would prefer to continue using Powershell. When you say it works for you, is that on a Linux install as well? Could it be that the Windows/Powershell combo never has been working?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 11:16:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326277#M60651</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2017-10-27T11:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326278#M60652</link>
      <description>&lt;P&gt;Yes, It is Linux.&lt;/P&gt;

&lt;P&gt;Let me try Windows/Powershell combo.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 11:22:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326278#M60652</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-27T11:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326279#M60653</link>
      <description>&lt;P&gt;@kamlesh_vaghela &amp;amp; @rune.hellem,&lt;/P&gt;

&lt;P&gt;Based on the documentation &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.6.0/AdvancedDev/CustomAlertScript#Script_naming_guidelines"&gt;http://docs.splunk.com/Documentation/Splunk/6.6.0/AdvancedDev/CustomAlertScript#Script_naming_guidelines&lt;/A&gt; , stansa which is given in &lt;CODE&gt;alert_actions.conf&lt;/CODE&gt; and &lt;CODE&gt;scriptname&lt;/CODE&gt; should be same. However there are no powershell example provided in doc. Based on above configuration it looks like it is different. &lt;/P&gt;

&lt;P&gt;I am not big fan of Windows &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt; and I never tried custom alert actions on Windows so I may be wrong but I am running custom alert actions on linux very well. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 11:29:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326279#M60653</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-10-27T11:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326280#M60654</link>
      <description>&lt;P&gt;@harsmarvania57&lt;/P&gt;

&lt;P&gt;Thanks for your input.&lt;/P&gt;

&lt;P&gt;Here we executing the command &amp;amp; It is working properly. As mentioned in question script is executing properly and log output is provided in the question. So here I assumed that script is executing properly. The issue regarding configuration &amp;amp; payload, which is not found.&lt;/P&gt;

&lt;P&gt;@rune.hellem,&lt;BR /&gt;
Kindly correct me if I'm wrong.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 11:47:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326280#M60654</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-27T11:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326281#M60655</link>
      <description>&lt;P&gt;Another idea if you agree.  &lt;/P&gt;

&lt;P&gt;Can we pass $job.resultCount$ &amp;amp; $job.search$ as an argument of an command??&lt;BR /&gt;
like.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;alert.execute.cmd.arg.4 = $job.resultCount$
alert.execute.cmd.arg.5 =$job.search$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do we able to access argument 4 &amp;amp; 5 in powerShell??&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 11:49:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326281#M60655</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-27T11:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get value of job.resultCount when using Custom Alert Action</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326282#M60656</link>
      <description>&lt;P&gt;Added&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;alert.execute.cmd.arg.4 = $job.resultCount$
alert.execute.cmd.arg.5 =$job.search$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But, unfortunately&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[10/27/2017 4:12 PM]: Arg 1: $job.resultCount$
[10/27/2017 4:12 PM]: Arg 2: $job.search$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Does not seem that the variables are accessible in neither scope on Windows other than when logging a generic_single_line&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; action.logevent = 1
 action.logevent.param.event = nimsoftCustomAlert=true antall=$result.count$ antallJob=$job.resultCount$
 action.logevent.param.host = splunksearch
 action.logevent.param.index = filenetprod
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:30:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-t-get-value-of-job-resultCount-when-using-Custom-Alert/m-p/326282#M60656</guid>
      <dc:creator>rune_hellem</dc:creator>
      <dc:date>2020-09-29T16:30:21Z</dc:date>
    </item>
  </channel>
</rss>

