Skip to content

Commit bd756dc

Browse files
committed
Only warn 5 times that af_unix is dropping an event
1 parent 8e926f5 commit bd756dc

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

audisp/plugins/af_unix/audisp-af_unix.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ static int read_binary_record(int fd, struct audit_dispatcher_header *hdr,
355355
return sizeof(*hdr) + hdr->size;
356356
}
357357

358+
int failed_append = 0;
358359
void read_audit_record(int ifd)
359360
{
360361
int len;
@@ -406,10 +407,14 @@ void read_audit_record(int ifd)
406407
&str_len) < 0)
407408
return;
408409

409-
if (q_append(queue, str, str_len) != 0)
410-
syslog(LOG_ERR,
411-
"Queue append failed (%s)",
412-
strerror(errno));
410+
if (q_append(queue, str, str_len) != 0) {
411+
if (failed_append < 5)
412+
syslog(LOG_ERR,
413+
"Dropping event - queue append failed (%s)",
414+
strerror(errno));
415+
failed_append++;
416+
} else
417+
failed_append = 0;
413418
free(str);
414419
} else if (format == F_BINARY) {
415420
int total = sizeof(*hdr) + hdr->size;
@@ -418,10 +423,14 @@ void read_audit_record(int ifd)
418423
memcpy(buf, hdr, sizeof(*hdr));
419424
memcpy(buf + sizeof(*hdr), data,
420425
hdr->size);
421-
if (q_append(queue, buf, total) != 0)
422-
syslog(LOG_ERR,
423-
"Queue append failed (%s)",
424-
strerror(errno));
426+
if (q_append(queue, buf, total) != 0) {
427+
if (failed_append < 5)
428+
syslog(LOG_ERR,
429+
"Dropping event - queue append failed (%s)",
430+
strerror(errno));
431+
failed_append++;
432+
} else
433+
failed_append = 0;
425434
free(buf);
426435
}
427436
}

0 commit comments

Comments
 (0)