<?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: custom command logging error in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249405#M74461</link>
    <description>&lt;P&gt;Can you find the splunklib directory on your system?&lt;/P&gt;</description>
    <pubDate>Mon, 17 Oct 2016 02:37:57 GMT</pubDate>
    <dc:creator>lquinn</dc:creator>
    <dc:date>2016-10-17T02:37:57Z</dc:date>
    <item>
      <title>custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249399#M74455</link>
      <description>&lt;P&gt;I've followed this tutorial:&lt;BR /&gt;
&lt;A href="http://blogs.splunk.com/2014/04/14/building-custom-search-commands-in-python-part-i-a-simple-generating-command/"&gt;http://blogs.splunk.com/2014/04/14/building-custom-search-commands-in-python-part-i-a-simple-generating-command/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Downloaded this respository:&lt;BR /&gt;
&lt;A href="https://github.com/splunk/splunk-sdk-python"&gt;https://github.com/splunk/splunk-sdk-python&lt;/A&gt;&lt;BR /&gt;
and build it using python setup.py install and just followed the instructions on the tutoiral.&lt;/P&gt;

&lt;P&gt;When I got to testing the command outside of splunk section of the tutorial, I tried it:&lt;BR /&gt;
python generatehello.py __EXECUTE count=5&lt;/P&gt;

&lt;P&gt;and I got errors that my logging.conf is not valid because I lack of handlers,&lt;BR /&gt;
and I fixed the conf by the errors, one by one.&lt;/P&gt;

&lt;P&gt;Here's my logging.conf:&lt;BR /&gt;
&lt;A href="http://pastebin.com/KwN37JYe"&gt;http://pastebin.com/KwN37JYe&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;and now I have this error:&lt;BR /&gt;
&lt;A href="http://pastebin.com/HjS9km3L"&gt;http://pastebin.com/HjS9km3L&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;How do I fix this?&lt;BR /&gt;
Why do I have all this errors? I've just downloaded it and followed the instructions.&lt;BR /&gt;
I have windows 10. Splunk 6.5.0 running as localhost on my pc.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2016 14:35:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249399#M74455</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2016-10-15T14:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249400#M74456</link>
      <description>&lt;P&gt;Hi tombog0,&lt;/P&gt;

&lt;P&gt;what happens if you run the script like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  $SPLUNK_HOME/bin/splunk cmd python generatehello.py __EXECUTE count=5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Sun, 16 Oct 2016 22:06:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249400#M74456</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-10-16T22:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249401#M74457</link>
      <description>&lt;P&gt;"D:\Program Files\Splunk\bin\splunk.exe" cmd python generatehello.py _&lt;EM&gt;EXECUTE&lt;/EM&gt; count=5&lt;BR /&gt;
Do you mean like that?&lt;/P&gt;

&lt;P&gt;It opens a cmd and closes it right away, I can't see what is written on it.&lt;/P&gt;

&lt;P&gt;I've also tried to run it from splunk&lt;BR /&gt;
| generatehello count=5&lt;BR /&gt;
and got this error:&lt;BR /&gt;
External search command 'generatehello' returned error code 1.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 00:51:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249401#M74457</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2016-10-17T00:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249402#M74458</link>
      <description>&lt;P&gt;Open a CMD and cd into "D:\Program Files\Splunk\bin". Run the command like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;splunk.exe cmd python generatehello.py __EXECUTE count=5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Oct 2016 01:19:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249402#M74458</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-10-17T01:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249403#M74459</link>
      <description>&lt;P&gt;You need to open command prompt in administrator mode in order to see the output. Thats why the window pops up and disappears again.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 01:21:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249403#M74459</guid>
      <dc:creator>lquinn</dc:creator>
      <dc:date>2016-10-17T01:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249404#M74460</link>
      <description>&lt;P&gt;generatehello.py was originally positioned at one of my apps btw.&lt;BR /&gt;
I copied it to the splunk/bin.&lt;/P&gt;

&lt;P&gt;After running it on splunk as administrator as you said,&lt;BR /&gt;
I get this errors:&lt;BR /&gt;
Traceback (most recent call last):&lt;BR /&gt;
  File "generatehello.py", line 4, in &lt;BR /&gt;
    from splunklib.searchcommands import \&lt;BR /&gt;
ImportError: No module named splunklib.searchcommands&lt;/P&gt;

&lt;P&gt;I found this guy had the same problem:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/243498/getinfo-probe-failed-for-external-search-command-a.html"&gt;https://answers.splunk.com/answers/243498/getinfo-probe-failed-for-external-search-command-a.html&lt;/A&gt;&lt;BR /&gt;
He said that he just downloaded a newer splunk-sdk-python and it fixed it, but I already have the newest from their master git, so it's not my case.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;

&lt;P&gt;Thanks for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 02:34:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249404#M74460</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2016-10-17T02:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249405#M74461</link>
      <description>&lt;P&gt;Can you find the splunklib directory on your system?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 02:37:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249405#M74461</guid>
      <dc:creator>lquinn</dc:creator>
      <dc:date>2016-10-17T02:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249406#M74462</link>
      <description>&lt;P&gt;Yes. found it, I've wrote pip install splunk-sdk and it wrote that it's already up to date and wrote where it is.&lt;/P&gt;

&lt;P&gt;It's here:&lt;BR /&gt;
C:\python27\lib\site-packages\splunk_sdk-1.6.0-py2.7.egg\splunklib&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 02:47:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249406#M74462</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2016-10-17T02:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249407#M74463</link>
      <description>&lt;P&gt;This might be the wrong way to do it ... but I think I've had to make a copy of the splunklib directory before and paste it into the bin directory of the app that I'm running my search command from. I think this happened to me a while ago and this was my quick fix!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 02:52:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249407#M74463</guid>
      <dc:creator>lquinn</dc:creator>
      <dc:date>2016-10-17T02:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249408#M74464</link>
      <description>&lt;P&gt;Now it complains about my "default/commands.conf"&lt;BR /&gt;
that does not exist.&lt;BR /&gt;
I guess it's because I've copied generatehello.py to the bin without its config.&lt;BR /&gt;
Is there a way to run it on my app?&lt;BR /&gt;
I've tried&lt;BR /&gt;
splunk.exe cmd python "D:\ProgramFiles\Splunk\etc\apps\generatehello_app\bin\generatehello.py"  __EXECUTE count=5&lt;BR /&gt;
and got the same error I got on the beggining of the thread of the logging.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:26:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249408#M74464</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2020-09-29T11:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249409#M74465</link>
      <description>&lt;P&gt;Are you able to run it from Splunk UI? With the splunklib directory and generatehello.py in you app/bin directory. Is your app scope global?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 03:15:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249409#M74465</guid>
      <dc:creator>lquinn</dc:creator>
      <dc:date>2016-10-17T03:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249410#M74466</link>
      <description>&lt;P&gt;I'm not able to run it from splunk UI with the splunklib in app/bin.&lt;BR /&gt;
I don't think it's scope global, how do I check? &lt;BR /&gt;
Anyway it also doesn't work on the app scope itself.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 04:11:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249410#M74466</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2016-10-17T04:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249411#M74467</link>
      <description>&lt;P&gt;I'm not able to run it from the splunk ui.&lt;BR /&gt;
I don't think my app is global scope. &lt;BR /&gt;
How do I check it?&lt;BR /&gt;
Anyway, it doesn't even work on its own scope.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 04:56:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249411#M74467</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2016-10-17T04:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249412#M74468</link>
      <description>&lt;P&gt;I'm not able to run it from the splunk ui.&lt;BR /&gt;
I don't think my app is global scope. &lt;BR /&gt;
How do I check it?&lt;BR /&gt;
Anyway, it doesn't even work on it own scope.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 04:57:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249412#M74468</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2016-10-17T04:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249413#M74469</link>
      <description>&lt;P&gt;I'm not able to run it from Splunk UI.&lt;BR /&gt;
I dont think my app is scope global. How do I check?&lt;BR /&gt;
Anyway it doesnt even work on its own scope.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 07:29:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249413#M74469</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2016-10-17T07:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249414#M74470</link>
      <description>&lt;P&gt;I'm not able to run it from Splunk UI.&lt;BR /&gt;
I dont think my app is scope global. How do I check?&lt;BR /&gt;
Anyway it doesnt even work on its own scope.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 07:31:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249414#M74470</guid>
      <dc:creator>tombog0</dc:creator>
      <dc:date>2016-10-17T07:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: custom command logging error</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249415#M74471</link>
      <description>&lt;P&gt;I've never done it this way... instead i do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunk.mining.dcutils as dcu
logger = dcu.getLogger()

logger.info("string to log to index=_internal as Log_Level=info")
logger.warn("string to log to index=_internal as Log_Level=warn")
logger.error("string to log to index=_internal as Log_Level=error")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Not sure if that helps you but thought it was worth the mention.  Should be fully compatible with the SDK, etc.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 18:03:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-command-logging-error/m-p/249415#M74471</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-10-18T18:03:26Z</dc:date>
    </item>
  </channel>
</rss>

