AUSEARCH_ADD...ERPRETED_ITEM(3)

πŸ“¦
version 4.2.1 Β· 3 versions
, in alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, fedora 43, fedora 44, nixpkgs unstable, ubuntu resolute, ubuntu stonking

πŸ’– AUSEARCH_ADD_INTERPRETED_ITEM(3) πŸ’–

okay bestie, gather round, because we're doing Linux Audit API today and it's actually so good. this is ausearch_add_interpreted_item from <auparse.h>, and she's a whole mood: she builds up a search rule, one little condition at a time. πŸŽ€


✨ NAME ✨

ausearch_add_interpreted_item β€” build up search rule

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <auparse.h>

int ausearch_add_interpreted_item(auparse_state_t *au, const char *field,
                                  const char *op, const char *value,
                                  ausearch_rule_t how);

🌸 DESCRIPTION 🌸

so basically, ausearch_add_interpreted_item adds one search condition to the current audit search expression. then you can take those search conditions and use them to scan logs, files, or buffers for something of interest. it's giving detective energy, fr fr. πŸ”

  • field β€” the field name that the value is gonna be checked for. that's the whole assignment, bestie.
  • op β€” describes what kind of check is being done.

the legal op values are, and yes we're listing all of them:

  • exists β€” just check that a field name exists. that's it, that's the whole job. lowkey the simplest one. ✨
  • = β€” locate the field name and check that the value associated with it is equal to the value given in this rule.
  • != β€” locate the field name and check that the value associated with it is NOT equal to the value given in this rule. the hater of the group, iconic. πŸ’…

the value parameter gets compared to the interpreted field value β€” aka the value that would be returned by auparse_interpret_field(3). no cap, that's the important bit.


🫢 the how value 🫢

the how value determines how this search condition is gonna affect the existing search expression, if one is already defined. the possible values are:

  • AUSEARCH_RULE_CLEAR β€” clear the current search expression, if any, and use only this search condition. starting fresh, main character energy. πŸ’€
  • AUSEARCH_RULE_OR β€” if a search expression E is already configured, replace it by (E || this_search_condition).
  • AUSEARCH_RULE_AND β€” if a search expression E is already configured, replace it by (E && this_search_condition).
ngl these three are the moment. pick wisely which one you want, because CLEAR will absolutely wipe what you had. πŸ™ˆ

⭐ RETURN VALUE ⭐

returns -1 if an error occurs; otherwise, 0 for success. classic. that's the whole vibe check.

🌈 SEE ALSO 🌈

πŸ‘‘ AUTHOR πŸ‘‘

Steve Grubb. we stan. πŸ’œ


okay that's the whole page, you ate that. this absolute classic was brought to you by Red Hat, dated Nov 2007, and it lives in section 3 of the Linux Audit API manual, filed under AUSEARCH_ADD...ERPRETED_ITEM(3). go forth and search, bestie. 🧚✨