AUSEARCH_ADD_TIMESTAMP_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_TIMESTAMP_ITEM(3) πŸ’–

okay bestie, welcome to the Linux Audit API corner of the group chat ✨ this one's ausearch_add_timestamp_item, and she's literally the moment you want to build a search rule based on when stuff happened πŸ•°οΈ


🌸 NAME 🌸

ausearch_add_timestamp_item β€” build up search rule 🫢


✨ SYNOPSIS ✨

#include <auparse.h>

int ausearch_add_timestamp_item(auparse_state_t *au, const char *op, time_t sec,
                                unsigned milli, ausearch_rule_t how);

πŸ¦‹ DESCRIPTION πŸ¦‹

so ausearch_add_timestamp_item adds an event time condition to the current audit search expression, no biggie πŸ’… and like β€” once you've got your search conditions stacked up, you can use them to scan logs, files, or buffers for something of interest πŸ‘€ iconic behaviour honestly.

the op parameter is the vibe check on the comparison β€” it says which comparison you want. the legal op values are:

  • <
  • <=
  • >=
  • >
  • =

and just so we're clear on the math, bestie: the left operand of the comparison operator is the timestamp of the examined event, and the right operand is whatever you passed in through the sec and milli parameters. that's the whole setup πŸŽ€

now, the how value is the one that decides how this search condition is gonna affect the search expression you've already got going, if one's already defined. the possible values are:

  • AUSEARCH_RULE_CLEAR β€” clears the current search expression, if any, and uses only this search condition. like a clean slate, periodt 🧹
  • AUSEARCH_RULE_OR β€” if a search expression E is already configured, it gets replaced by (E || this_search_condition). two vibes, either one works 🌈
  • AUSEARCH_RULE_AND β€” if a search expression E is already configured, it gets replaced by (E && this_search_condition). both or nothing, no cap πŸ”₯

πŸ’« RETURN VALUE πŸ’«

returns -1 if an error occurs; otherwise, 0 for success. that's it, that's the whole story πŸ’€


πŸ‘‘ APPLICATION USAGE πŸ‘‘

use ausearch_add_item(3) and ausearch_add_interpreted_item(3) when you wanna add conditions that check audit record fields instead. and use ausearch_add_expression(3) if you wanna add complex search expressions in one single function call β€” one call, whole fit, slay πŸ’…


πŸŽ€ SEE ALSO πŸŽ€


πŸ’œ AUTHOR πŸ’œ

Miloslav Trmac 🫢


and that's a wrap, bestie!! this little masterpiece came to you courtesy of Red Hat, back in Aug 2014, and yes she's still serving under the name AUSEARCH_ADD_TIMESTAMP_ITEM(3) 🌟 go forth and timestamp responsibly, ily πŸ’–βœ¨