audit_log_user_comm_message(3)

audit_log_user_comm_message3

Log a user message from a console app

Usage

#include <libaudit.h>

int audit_log_user_comm_message(int audit_fd, int type, const char *message, const char *comm, const char *hostname, const char *addr, const char *tty, int result);

Overview

This function will log a message to the audit system using a predefined message format. This function should be used by all non-ELF console apps that do not manipulate accounts, groups, or need to log execution of a script. An example would be a Python script recording an event. The function parameters are as follows:

audit_fd - The fd returned by audit_open
type - type of message, ex: AUDIT_USYS_CONFIG, AUDIT_USER_LOGIN
message - the message text being sent
comm - the task command name from /proc/self/comm, NULL if unknown
hostname - the hostname if known, NULL if unknown
addr - The network address of the user, NULL if unknown
tty - The tty of the user, if NULL will attempt to figure out
result - 1 is "success" and 0 is "failed"

The kernel task command name is limited to 15 bytes because TASK_COMM_LEN is 16 bytes including the terminating null byte. A non-NULL comm value longer than 15 bytes is truncated to 15 bytes and a warning is logged.

Return value

It returns the sequence number which is > 0 on success or <= 0 on error.

Errors

This function returns -1 on failure. Examine errno for more info.

Releases

10 releases since Debian 5.0 (Lenny); the text changed 4 times.

  1. 5.0–6.0
  2. 7
  3. 8
  4. 9–13
  5. Arch

Author

Steve Grubb

From audit 4.2.1-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.