<div dir="ltr"><div dir="ltr"><div>Hi Steve,</div><div><br></div><div>Thanks for the reply. I compared the record string I was passing to auparse_feed() against the example string in auparse/test/auparse_test.c (in audit-userspace git repo).</div><div>Looks like I needed to prepend "msg=" before the audit message and pass the exact length of the record string to auparse_feed().</div><div><br></div><div>Changing the lines in to the code to:</div><div><br></div><div>snprintf(record_buffer, (record_buffer_len - 1), "type=%s msg=%.*s\n", type_name, reply.len, reply.message);</div><div>auparse_feed(au, record_buffer, strlen(record_buffer));</div><div><br></div><div>worked.</div><div><br></div><div>Also I noticed that the EOE record is treated as its own event even though there were other records with the same audit serial number. I guess this is expected as after EOE there will be no more records for this event and if EOE was treated as a part of the previous event, then it will not be possible to tell when this event is complete.</div><div><br></div><div>Thanks for the help,</div><div>Tarun<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 11, 2019 at 9:49 PM Steve Grubb <<a href="mailto:sgrubb@redhat.com">sgrubb@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tuesday, June 11, 2019 2:56:23 AM EDT Tarun Ramesh wrote:<br>
> The callback function on_audit_event() just goes through the records one by<br>
> one and prints the fields and values. I have added a rule to watch for<br>
> file edits in the /home folder. I see the records for file creation in<br>
> this folder being received, however it looks like the callback function is<br>
> not being called when an EOE record is received. Please let me know if I'm<br>
> missing something.<br>
<br>
As long as the format exactly matched how auditd creates the record, cursory <br>
glance appears ok, then the records get grouped inside auparse to form a <br>
complete event. When the event is determined to be complete, it is passed to <br>
the registered callback function. You need to iterate over the individual <br>
records to see the whole event. <br>
<br>
So, you do not get a callback on an individual record, you are called back on <br>
a complete event. The EOE record should be the last record. You can use <br>
auparse_next_record() to iterate across records.<br>
<br>
-Steve<br>
<br>
<br>
<br>
</blockquote></div></div>