AUDIT_LOG_USER_COMM_MESSAGE(3)
π AUDIT_LOG_USER_COMM_MESSAGE π
okay bestie, welcome to section 3 of the Linux Audit API manual, and today's main character is audit_log_user_comm_message. yes it's a long name. no we're not abbreviating it. it ate and it knows it.
β¨ NAME β¨
audit_log_user_comm_message β log a user message from a console app π«Ά
πΈ SYNOPSIS πΈ
#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);
like. eight arguments. she's high maintenance but she's worth it π
π¦ DESCRIPTION π¦
so this function logs a message into the audit system using a predefined message format. it's the one you want if you're a non-ELF console app that does not mess with accounts, does not mess with groups, and doesn't need to log script execution. think a Python script recording an event β that's literally the vibe. π
here's the rundown on every single parameter, no skipping, we don't do that here:
audit_fdβ the fd thataudit_openhanded youtypeβ type of message, e.g.AUDIT_USYS_CONFIG,AUDIT_USER_LOGINmessageβ the message text being sentcommβ the task command name from/proc/self/comm, orNULLif it's unknownhostnameβ the hostname if known,NULLif unknownaddrβ the network address of the user,NULLif unknownttyβ the tty of the user; if it'sNULLshe'll attempt to figure it out herself πresultβ1is "success" and0is "failed"
β οΈ okay important lore: the kernel task command name is capped at 15 bytes, becauseTASK_COMM_LENis 16 bytes including the terminating null byte. so if you pass a non-NULLcommthat's longer than 15 bytes, it gets truncated to 15 bytes and a warning gets logged. that's not a suggestion, that's just what happens π
β RETURN VALUE β
she returns the sequence number β that's > 0 on success, or <= 0 on error. so like, positive = slay, zero-or-below = not slay. π
π ERRORS π
this function returns -1 on failure. go examine errno for more info, bestie, the answers are in there.
π₯ SEE ALSO π₯
audit_log_user_message(3)audit_log_acct_message(3)audit_log_user_avc_message(3)audit_log_semanage_message(3)
the whole friend group honestly π
π AUTHOR π
Steve Grubb
and that's the page!! brought to you by Red Hat, dated July 2016 β yes this manual page is a whole adult now and it's still serving. mwah πβ¨π
π¦ where this page comes from
- arch rolling: audit 4.2.1-1 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- centos-stream 10: audit-libs-devel 4.2.1-3.el10 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.2.1-1.fc43 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.2.1-1.fc43 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.2.1-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.2.1-1.fc44 Β· LGPL-2.0-or-later
- nixpkgs unstable: audit 4.2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms