<?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 How to implement rlog.sh/ausearch utility for an audit.log of different format in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-implement-rlog-sh-ausearch-utility-for-an-audit-log-of/m-p/589696#M103391</link>
    <description>&lt;P&gt;Hi&amp;nbsp;all,&lt;/P&gt;
&lt;P&gt;Please help with the below.&amp;nbsp; I am using rlog.sh (inbuilt script) provided by Splunk in TA-unix package , to apply ausearch utility for linux audit logs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SEEK_FILE=$SPLUNK_HOME/var/run/splunk/unix_audit_seekfile_model_prod
AUDIT_FILE=/opt/splunklogs_app/audit_prod/audit.log

           if [ -e $SEEK_FILE ] ; then
                SEEK=`head -1 $SEEK_FILE`
            else
                SEEK=0
                echo "0" &amp;gt; $SEEK_FILE
            fi
            FILE_LINES=`wc -l $AUDIT_FILE  | cut -d " " -f 1`
            if [ $FILE_LINES -lt $SEEK ] ; then
                # audit file has wrapped
                SEEK=0
            fi
            awk -v START=$SEEK -v OUTPUT=$SEEK_FILE 'NR&amp;gt;START { print } END { print NR &amp;gt; OUTPUT }' $AUDIT_FILE | tee $TEE_DEST | /sbin/ausearch -i 2&amp;gt;/dev/null | grep -v "^----"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This inbuilt script is converting default format of linux audit logs by applying ausearch utility.&lt;BR /&gt;&lt;BR /&gt;example below:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;Log input :&lt;/U&gt;&lt;BR /&gt;&lt;BR /&gt;type=TTY msg=&lt;FONT color="#008000"&gt;&lt;STRONG&gt;audit(1647315634.249:442)&lt;/STRONG&gt;&lt;/FONT&gt;: tty pid=2962 uid=0 auid=1001 ses=1368 major=136 minor=0 comm="bash" data=7669202F6574632F727375737F7F79730963090D&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;Log output after using rlog.sh&lt;/U&gt;&lt;BR /&gt;&lt;BR /&gt;type=TTY msg=&lt;STRONG&gt;&lt;FONT color="#008000"&gt;audit(03/15/2022 14:40:34.791:2962)&lt;/FONT&gt;&lt;/STRONG&gt;: tty pid=2962 uid=root auid=root ses=1368 major=136 minor=0 comm="bash" data=7669202F6574632F727375737F7F79730963090D&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I have audit.log being generated in a different format.. like below..&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;My audit.log:&lt;BR /&gt;&lt;BR /&gt;&lt;/U&gt;&lt;FONT color="#FF0000"&gt;(custom audit.log format)&lt;/FONT&gt;&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;&lt;FONT color="#800080"&gt;IP: 10.200.30.40 | &amp;lt;158&amp;gt;Mar 11 16:10:24 xxx-yyy-zzz AuditLog type=SYSCALL msg=audit(1646979024.027:1697): arch=c000003e syscall=4 success=yes exit=0 a0=7f1304042410 a1=7f13092f66a0 a2=7f13092f66a0 a3=0 items=1 ppid=1 pid=2270 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="in:imfile" exe="/usr/sbin/rsyslogd" subj=system_u:system_r:syslogd_t:s0 key=(null) Hostname=10.200.30.40&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;(default audit.log format)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;type=USER_TTY msg=audit(1646592289.268:441): pid=2962 uid=0 auid=1001 ses=1368 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 data=73797374656D63746C2073746174757320727379736C6F67 Hostname=xxx&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;BR /&gt;so basically I will have logs of both default audit log format and this custom format being logged in audit.log. When I apply the rlog.sh/ausearch utility to this log, only logs with default audit.log type are being converted with ausearch utility and sent to output and indexed, the other logs are not even being sent to output.&lt;BR /&gt;&lt;BR /&gt;Please help.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Mar 2022 15:12:08 GMT</pubDate>
    <dc:creator>bhargavi</dc:creator>
    <dc:date>2022-03-18T15:12:08Z</dc:date>
    <item>
      <title>How to implement rlog.sh/ausearch utility for an audit.log of different format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-implement-rlog-sh-ausearch-utility-for-an-audit-log-of/m-p/589696#M103391</link>
      <description>&lt;P&gt;Hi&amp;nbsp;all,&lt;/P&gt;
&lt;P&gt;Please help with the below.&amp;nbsp; I am using rlog.sh (inbuilt script) provided by Splunk in TA-unix package , to apply ausearch utility for linux audit logs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SEEK_FILE=$SPLUNK_HOME/var/run/splunk/unix_audit_seekfile_model_prod
AUDIT_FILE=/opt/splunklogs_app/audit_prod/audit.log

           if [ -e $SEEK_FILE ] ; then
                SEEK=`head -1 $SEEK_FILE`
            else
                SEEK=0
                echo "0" &amp;gt; $SEEK_FILE
            fi
            FILE_LINES=`wc -l $AUDIT_FILE  | cut -d " " -f 1`
            if [ $FILE_LINES -lt $SEEK ] ; then
                # audit file has wrapped
                SEEK=0
            fi
            awk -v START=$SEEK -v OUTPUT=$SEEK_FILE 'NR&amp;gt;START { print } END { print NR &amp;gt; OUTPUT }' $AUDIT_FILE | tee $TEE_DEST | /sbin/ausearch -i 2&amp;gt;/dev/null | grep -v "^----"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This inbuilt script is converting default format of linux audit logs by applying ausearch utility.&lt;BR /&gt;&lt;BR /&gt;example below:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;Log input :&lt;/U&gt;&lt;BR /&gt;&lt;BR /&gt;type=TTY msg=&lt;FONT color="#008000"&gt;&lt;STRONG&gt;audit(1647315634.249:442)&lt;/STRONG&gt;&lt;/FONT&gt;: tty pid=2962 uid=0 auid=1001 ses=1368 major=136 minor=0 comm="bash" data=7669202F6574632F727375737F7F79730963090D&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;Log output after using rlog.sh&lt;/U&gt;&lt;BR /&gt;&lt;BR /&gt;type=TTY msg=&lt;STRONG&gt;&lt;FONT color="#008000"&gt;audit(03/15/2022 14:40:34.791:2962)&lt;/FONT&gt;&lt;/STRONG&gt;: tty pid=2962 uid=root auid=root ses=1368 major=136 minor=0 comm="bash" data=7669202F6574632F727375737F7F79730963090D&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I have audit.log being generated in a different format.. like below..&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;My audit.log:&lt;BR /&gt;&lt;BR /&gt;&lt;/U&gt;&lt;FONT color="#FF0000"&gt;(custom audit.log format)&lt;/FONT&gt;&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;&lt;FONT color="#800080"&gt;IP: 10.200.30.40 | &amp;lt;158&amp;gt;Mar 11 16:10:24 xxx-yyy-zzz AuditLog type=SYSCALL msg=audit(1646979024.027:1697): arch=c000003e syscall=4 success=yes exit=0 a0=7f1304042410 a1=7f13092f66a0 a2=7f13092f66a0 a3=0 items=1 ppid=1 pid=2270 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="in:imfile" exe="/usr/sbin/rsyslogd" subj=system_u:system_r:syslogd_t:s0 key=(null) Hostname=10.200.30.40&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;(default audit.log format)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;type=USER_TTY msg=audit(1646592289.268:441): pid=2962 uid=0 auid=1001 ses=1368 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 data=73797374656D63746C2073746174757320727379736C6F67 Hostname=xxx&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;BR /&gt;so basically I will have logs of both default audit log format and this custom format being logged in audit.log. When I apply the rlog.sh/ausearch utility to this log, only logs with default audit.log type are being converted with ausearch utility and sent to output and indexed, the other logs are not even being sent to output.&lt;BR /&gt;&lt;BR /&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 15:12:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-implement-rlog-sh-ausearch-utility-for-an-audit-log-of/m-p/589696#M103391</guid>
      <dc:creator>bhargavi</dc:creator>
      <dc:date>2022-03-18T15:12:08Z</dc:date>
    </item>
  </channel>
</rss>

