<?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: Scripted input of ausearch returns different output compared to when run from the command line in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Scripted-input-of-ausearch-returns-different-output-compared-to/m-p/112985#M8259</link>
    <description>&lt;P&gt;So I found the fix. I should have read the man file for ausearch more carefully. &lt;A href="http://www.linuxcommand.org/man_pages/ausearch8.html"&gt;From the documentation for ausearch:&lt;/A&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;--input-logs
Use the log file location from auditd.conf as input for searching. This is needed if you are using ausearch from a cron job.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This value is defined globally in &lt;CODE&gt;/etc/audit/auditd.conf&lt;/CODE&gt; but in this instance we need to tell ausearch that it is ok to use that file.&lt;/P&gt;

&lt;P&gt;The working command for my scripted input in * &lt;STRONG&gt;get_ausearch.sh&lt;/STRONG&gt; * is&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sudo /sbin/ausearch --start recent --key testing --input-logs&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Even though this isn't strictly a cron job, this is the only reasonable explanation I can find. Someone please correct me if I am wrong.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;(Edited with the correct information, my previous answer was slightly incorrect)&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Nov 2014 18:17:06 GMT</pubDate>
    <dc:creator>neiljpeterson</dc:creator>
    <dc:date>2014-11-05T18:17:06Z</dc:date>
    <item>
      <title>Scripted input of ausearch returns different output compared to when run from the command line</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Scripted-input-of-ausearch-returns-different-output-compared-to/m-p/112984#M8258</link>
      <description>&lt;P&gt;I am using a scripted input from ausearch to get logs from audit.d&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;inputs.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://./bin/get_ausearch.sh]
sourcetype=linux_audit
interval=* * * * *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;get_ausearch.sh&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sudo /sbin/ausearch --start recent -k testing
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tested this with &lt;CODE&gt;splunkd&lt;/CODE&gt; running as both &lt;CODE&gt;root&lt;/CODE&gt; and as &lt;CODE&gt;splunk&lt;/CODE&gt;(which is in &lt;CODE&gt;sudoers&lt;/CODE&gt;) and I get the same result.&lt;/P&gt;

&lt;P&gt;The result I get in Splunk is&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;11-05-2014 10:17:00.074 -0600 ERROR ExecProcessor - message from "/opt/splunkforwarder/etc/apps/myapp/bin/get_ausearch.sh"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This is actual output &lt;EM&gt;from&lt;/EM&gt; &lt;CODE&gt;ausearch&lt;/CODE&gt; (note the &lt;CODE&gt;ERROR&lt;/CODE&gt; and the ``) it is just not the &lt;EM&gt;correct&lt;/EM&gt; output.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Simultaneously&lt;/EM&gt; I can manually run the script (or copy the command verbatim) and get the &lt;EM&gt;correct&lt;/EM&gt; results I expect to see.&lt;/P&gt;

&lt;P&gt;I am also redirected stdout, stderr to files and got the same results.&lt;/P&gt;

&lt;P&gt;Any idea what is going on here? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;NOTE
I could, of course, monitor the  audit.log file itself but I want to filter on the key, 
and not index all of the audit events. I also realize that the suggested approach 
is to use the rlog.sh from Splunk Add-on for Unix and Linux but this is very narrow 
and specific monitoring use case, so I am trying to come up with the lightest approach possible.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Nov 2014 16:44:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Scripted-input-of-ausearch-returns-different-output-compared-to/m-p/112984#M8258</guid>
      <dc:creator>neiljpeterson</dc:creator>
      <dc:date>2014-11-05T16:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Scripted input of ausearch returns different output compared to when run from the command line</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Scripted-input-of-ausearch-returns-different-output-compared-to/m-p/112985#M8259</link>
      <description>&lt;P&gt;So I found the fix. I should have read the man file for ausearch more carefully. &lt;A href="http://www.linuxcommand.org/man_pages/ausearch8.html"&gt;From the documentation for ausearch:&lt;/A&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;--input-logs
Use the log file location from auditd.conf as input for searching. This is needed if you are using ausearch from a cron job.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This value is defined globally in &lt;CODE&gt;/etc/audit/auditd.conf&lt;/CODE&gt; but in this instance we need to tell ausearch that it is ok to use that file.&lt;/P&gt;

&lt;P&gt;The working command for my scripted input in * &lt;STRONG&gt;get_ausearch.sh&lt;/STRONG&gt; * is&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sudo /sbin/ausearch --start recent --key testing --input-logs&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Even though this isn't strictly a cron job, this is the only reasonable explanation I can find. Someone please correct me if I am wrong.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;(Edited with the correct information, my previous answer was slightly incorrect)&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 18:17:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Scripted-input-of-ausearch-returns-different-output-compared-to/m-p/112985#M8259</guid>
      <dc:creator>neiljpeterson</dc:creator>
      <dc:date>2014-11-05T18:17:06Z</dc:date>
    </item>
  </channel>
</rss>

