<?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 to get output from external commands run through Perl and use as scripted input in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264767#M189835</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The problem is in the stanza&lt;/P&gt;

&lt;P&gt;you have to use &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://./bin/dir_patrol.pl]
disabled = 0
interval = 60
sourcetype = dir_patrol
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope i help you&lt;/P&gt;</description>
    <pubDate>Wed, 30 Mar 2016 11:14:30 GMT</pubDate>
    <dc:creator>jmallorquin</dc:creator>
    <dc:date>2016-03-30T11:14:30Z</dc:date>
    <item>
      <title>How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264762#M189830</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;Am trying to run a command through perl and the results used as scripted input which will be indexed  by splunk.&lt;BR /&gt;
However i dont get any output when i run the script through splunk.&lt;BR /&gt;
i have tried the perl "system" module and "backticks" but none of it works.&lt;/P&gt;

&lt;P&gt;The script works fine if i run it manually through the command line.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$myresults = `find $flags[0] -maxdepth 1 -type f -name $flags[1] -mmin $min_val -ls`;
print  $myresults
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The script has been added to the input.conf.&lt;/P&gt;

&lt;P&gt;Some help will be much appreciated &lt;/P&gt;

&lt;P&gt;Thanks &lt;BR /&gt;
Sam&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 07:06:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264762#M189830</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2016-03-30T07:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264763#M189831</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Use the bin folder to write a sh script with you perl command, then in the inputs.conf configure a stanza with the sh script.&lt;/P&gt;

&lt;P&gt;Hope i help you.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 09:35:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264763#M189831</guid>
      <dc:creator>jmallorquin</dc:creator>
      <dc:date>2016-03-30T09:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264764#M189832</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
sorry i forgot to mention i have already done that.&lt;BR /&gt;
regular print statement in the script works fine.its just the ones with commands that doesnt work &lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 09:47:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264764#M189832</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2016-03-30T09:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264765#M189833</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you show the inputs.conf conf and also have you check that the user of splunk have rights to execute the script?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 09:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264765#M189833</guid>
      <dc:creator>jmallorquin</dc:creator>
      <dc:date>2016-03-30T09:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264766#M189834</link>
      <description>&lt;P&gt;this is the input.conf  and running this from the admin account &lt;/P&gt;

&lt;P&gt;[script://$SPLUNK_HOME/etc/apps/dir_patrol/bin/dir_patrol.pl]&lt;BR /&gt;
disabled = 0&lt;BR /&gt;
interval = 60.0&lt;BR /&gt;
sourcetype = dir_patrol&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:13:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264766#M189834</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2020-09-29T09:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264767#M189835</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The problem is in the stanza&lt;/P&gt;

&lt;P&gt;you have to use &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://./bin/dir_patrol.pl]
disabled = 0
interval = 60
sourcetype = dir_patrol
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope i help you&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 11:14:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264767#M189835</guid>
      <dc:creator>jmallorquin</dc:creator>
      <dc:date>2016-03-30T11:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264768#M189836</link>
      <description>&lt;P&gt;hi &lt;BR /&gt;
changing the input.conf didnt help.&lt;BR /&gt;
just to clarify.&lt;BR /&gt;
The actual script works.only this line below doesnt return any results &lt;BR /&gt;
"$myresults = &lt;CODE&gt;find $flags[0] -maxdepth 1 -type f -name $flags[1] -mmin $min_val -ls&lt;/CODE&gt;;" &lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 11:27:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264768#M189836</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2016-03-30T11:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264769#M189837</link>
      <description>&lt;P&gt;Ok,&lt;BR /&gt;
So the problem is with perl... have you try to build the command before execute?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$command =  "find." ".$flags[0]." -maxdepth 1 -type f -name"." ".$flags[1]." -mmin ".$min_val." -ls";
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;printf($command);&lt;BR /&gt;
system($command);&lt;/P&gt;

&lt;P&gt;Hope i help you&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 13:07:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264769#M189837</guid>
      <dc:creator>jmallorquin</dc:creator>
      <dc:date>2016-03-30T13:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264770#M189838</link>
      <description>&lt;P&gt;i tried your method ,i see no errors.However  the command does not show any results.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 06:36:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264770#M189838</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2016-03-31T06:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264771#M189839</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
review the _internal index to see if  there is any error.&lt;/P&gt;

&lt;P&gt;hope i help you&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 10:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264771#M189839</guid>
      <dc:creator>jmallorquin</dc:creator>
      <dc:date>2016-03-31T10:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264772#M189840</link>
      <description>&lt;P&gt;Hi Jmallorquin,&lt;/P&gt;

&lt;P&gt;i found out scripted input in splunk doesnt seem to work well with linux "find" with the "-ls" flag&lt;/P&gt;

&lt;P&gt;find . -maxdepth 1 -type f -name "*.xml" -mmin 300 -ls &lt;/P&gt;

&lt;P&gt;when i use the find command without "-ls" it get an output &lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 03:28:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264772#M189840</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2016-04-11T03:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get output from external commands run through Perl and use as scripted input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264773#M189841</link>
      <description>&lt;P&gt;an was provided in this &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/390425/scripted-input-and-not-working-well-with-linux-fin.html#answer-390458"&gt;https://answers.splunk.com/answers/390425/scripted-input-and-not-working-well-with-linux-fin.html#answer-390458&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2016 09:40:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-output-from-external-commands-run-through-Perl-and/m-p/264773#M189841</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2016-04-12T09:40:11Z</dc:date>
    </item>
  </channel>
</rss>

