Skip to content

Commit

Permalink
Exclude interp data from auditd (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
taglines authored Apr 19, 2021
1 parent 0f1e833 commit 163bb4a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion auomscollect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,16 @@ void DoStdinCollection(SPSCDataQueue& raw_queue, std::shared_ptr<Metric>& bytes_
return Signals::IsExit();
});
if (nr > 0) {
raw_queue.Commit(nr+sizeof(RecordType));
// Some versions of auditd will append interpreted data to the record line
// The interpreted data is separated from the record data by a \x1d char.
auto str_size = nr;
auto str = std::string_view(reinterpret_cast<char*>(ptr+sizeof(RecordType)), nr);
// Look for the \x1d char and exclude it and any data that follows
auto idx = str.find_first_of('\x1d');
if (idx != std::string_view::npos) {
str_size = idx;
}
raw_queue.Commit(str_size+sizeof(RecordType));
bytes_metric->Update(nr);
records_metric->Update(1.0);
} else if (nr == StdinReader::TIMEOUT) {
Expand Down

0 comments on commit 163bb4a

Please sign in to comment.