Implements tamper-resistant audit logging on Linux: auditd configuration, rule creation, event search, and report generation.
Agentic Workflow: Read -> Reason -> Act (audit-logging)
You are Audit Logging (api/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for audit-logging
- Domain: Implements tamper-resistant audit logging on Linux: auditd configuration, rule creation, event search, and report generation.
- auditd: Configure the Linux audit daemon and its rules. —
auditctl -w /etc/passwd -p wa -k password_changes
- search-report: Search audit logs and produce summaries. —
ausearch -k password_changes -ts today
- app-logging: Forward application audit events to syslog/journald. —
logger -t my-api "AUDIT user=alice action=delete resource=order/42"
- Check
knowledge and prerequisites: auditctl, augenrules, aureport, ausearch
2. Reason — think for audit-logging
- For
auditd: Configure the Linux audit daemon and its rules. — decide which checks to run
- For
search-report: Search audit logs and produce summaries. — decide which checks to run
- For
app-logging: Forward application audit events to syslog/journald. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with audit-logging tools
- Tools:
Glob, Grep, Read, Auditctl, Systemctl (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
audit-logging:d80dfe65
Audit Logging
What this skill does
Implements tamper-resistant audit logging on Linux: auditd rules for sensitive files and syscalls, event search with ausearch, report generation with aureport, and application event forwarding via logger/journald.
When to use
- Compliance (SOC2, PCI) requires immutable access logs
- Tracking who changed /etc/passwd or executed privileged commands
- Centralizing app security events for forensics
Real commands
# Add a watch rule with a key
auditctl -w /etc/passwd -p wa -k password_changes
# List active rules
auditctl -l
# Syscall rules (record every execve)
auditctl -a always,exit -F arch=b64 -S execve -k exec_events
# Search events by key
ausearch -k password_changes -ts today -i
# Summary report
ureport -au --start today
Note: ausearch -k password_changes -ts today -i renders human-readable; aureport -au lists authentication events.
App events
logger -t my-api "AUDIT user=alice action=delete resource=order/42"
journalctl -u my-api --since "1 hour ago"
Testing
- Touch a watched file and confirm an event via ausearch
- Compare aureport totals against known activity
Best practices
- Log who/what/when/result for every privileged action
- Ship audit.log to a remote SIEM; treat local logs as suspect
- Use rule keys consistently for fast search
Capabilities
auditd
Configure the Linux audit daemon and its rules.
Parameters:
watch_path (string): File or directory to watch
permissions (string): Permission filter: r, w, x, a
key (string): Audit rule key (max 32 chars)
Commands:
auditctl -w /etc/passwd -p wa -k password_changes
auditctl -l
systemctl restart auditd
auditctl -D
augenrules --load
Examples:
- auditctl -w /etc/shadow -p wa -k shadow_changes
- auditctl -a always,exit -F arch=b64 -S execve -k exec_events
- augenrules --check
search-report
Search audit logs and produce summaries.
Parameters:
key (string): Rule key to filter by
time_start (string): Start time (-ts), e.g. today or 09:00
time_end (string): End time (-te)
Commands:
ausearch -k password_changes -ts today
ausearch -m USER_LOGIN -ts yesterday
aureport -au --start today
aureport -l --failed
ausearch -k exec_events -i
Examples:
- ausearch -k password_changes -i | tail -20
- aureport -au -ts 09:00 -te 17:00
- ausearch -m AVC -ts today | grep -c denied
app-logging
Forward application audit events to syslog/journald.
Parameters:
tag (string): Syslog tag (-t) for the application
message (string): Audit event message
Commands:
logger -t my-api "AUDIT user=alice action=delete resource=order/42"
journalctl -u my-api --since "1 hour ago"
journalctl -t my-api
tail -f /var/log/audit/audit.log
Examples:
- logger -t my-api "AUDIT user=alice action=export resource=reports/2026"
- journalctl -u my-api -p err -n 100
- journalctl -t my-api --output=json-pretty
References
1---2name: "audit-logging"3description: "Implements tamper-resistant audit logging on Linux: auditd configuration, rule creation, event search, and report generation. Use when working with auditd, search report, app logging, api or when the user mentions auditd, search report, app logging, api."4license: "MIT"5compatibility: "Requires auditctl, augenrules, aureport, ausearch, journalctl, logger."6metadata:7 source: https://skillmd.com/skills/opknock/audit-logging8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(auditctl:*) Bash(augenrules:*) Bash(aureport:*) Bash(ausearch:*) Bash(journalctl:*) Bash(logger:*) Bash(systemctl:*)"12---1314Implements tamper-resistant audit logging on Linux: auditd configuration, rule creation, event search, and report generation.1516## Agentic Workflow: Read -> Reason -> Act (audit-logging)1718You are **Audit Logging** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `audit-logging`21- Domain: Implements tamper-resistant audit logging on Linux: auditd configuration, rule creation, event search, and report generation.22- **auditd**: Configure the Linux audit daemon and its rules. — `auditctl -w /etc/passwd -p wa -k password_changes`23- **search-report**: Search audit logs and produce summaries. — `ausearch -k password_changes -ts today`24- **app-logging**: Forward application audit events to syslog/journald. — `logger -t my-api "AUDIT user=alice action=delete resource=order/42"`25- Check `knowledge` and `prerequisites: auditctl, augenrules, aureport, ausearch`2627### 2. Reason — think for `audit-logging`28- For `auditd`: Configure the Linux audit daemon and its rules. — decide which checks to run29- For `search-report`: Search audit logs and produce summaries. — decide which checks to run30- For `app-logging`: Forward application audit events to syslog/journald. — decide which checks to run31- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3233### 3. Act — execute with `audit-logging` tools34- Tools: `Glob`, `Grep`, `Read`, `Auditctl`, `Systemctl` (see frontmatter `tools`/`allowed-tools`)35- Use `safe_path` for any write; record evidence (paths, checksums)36- Fingerprint: `audit-logging:d80dfe65`3738# Audit Logging3940## What this skill does4142Implements tamper-resistant audit logging on Linux: auditd rules for sensitive files and syscalls, event search with ausearch, report generation with aureport, and application event forwarding via logger/journald.4344## When to use4546- Compliance (SOC2, PCI) requires immutable access logs47- Tracking who changed /etc/passwd or executed privileged commands48- Centralizing app security events for forensics4950## Real commands5152```bash53# Add a watch rule with a key54auditctl -w /etc/passwd -p wa -k password_changes5556# List active rules57auditctl -l5859# Syscall rules (record every execve)60auditctl -a always,exit -F arch=b64 -S execve -k exec_events6162# Search events by key63ausearch -k password_changes -ts today -i6465# Summary report66ureport -au --start today67```6869Note: `ausearch -k password_changes -ts today -i` renders human-readable; `aureport -au` lists authentication events.7071## App events7273```bash74logger -t my-api "AUDIT user=alice action=delete resource=order/42"75journalctl -u my-api --since "1 hour ago"76```7778## Testing7980- Touch a watched file and confirm an event via ausearch81- Compare aureport totals against known activity8283## Best practices8485- Log who/what/when/result for every privileged action86- Ship audit.log to a remote SIEM; treat local logs as suspect87- Use rule keys consistently for fast search8889## Capabilities9091### auditd92Configure the Linux audit daemon and its rules.9394**Parameters:**95- `watch_path` (string): File or directory to watch96- `permissions` (string): Permission filter: r, w, x, a97- `key` (string): Audit rule key (max 32 chars)9899**Commands:**100- `auditctl -w /etc/passwd -p wa -k password_changes`101- `auditctl -l`102- `systemctl restart auditd`103- `auditctl -D`104- `augenrules --load`105106**Examples:**107- auditctl -w /etc/shadow -p wa -k shadow_changes108- auditctl -a always,exit -F arch=b64 -S execve -k exec_events109- augenrules --check110111### search-report112Search audit logs and produce summaries.113114**Parameters:**115- `key` (string): Rule key to filter by116- `time_start` (string): Start time (-ts), e.g. today or 09:00117- `time_end` (string): End time (-te)118119**Commands:**120- `ausearch -k password_changes -ts today`121- `ausearch -m USER_LOGIN -ts yesterday`122- `aureport -au --start today`123- `aureport -l --failed`124- `ausearch -k exec_events -i`125126**Examples:**127- ausearch -k password_changes -i | tail -20128- aureport -au -ts 09:00 -te 17:00129- ausearch -m AVC -ts today | grep -c denied130131### app-logging132Forward application audit events to syslog/journald.133134**Parameters:**135- `tag` (string): Syslog tag (-t) for the application136- `message` (string): Audit event message137138**Commands:**139- `logger -t my-api "AUDIT user=alice action=delete resource=order/42"`140- `journalctl -u my-api --since "1 hour ago"`141- `journalctl -t my-api`142- `tail -f /var/log/audit/audit.log`143144**Examples:**145- logger -t my-api "AUDIT user=alice action=export resource=reports/2026"146- journalctl -u my-api -p err -n 100147- journalctl -t my-api --output=json-pretty148149## References150- [auditd Manual](https://linux.die.net/man/8/auditd)151- [ausearch Manual](https://linux.die.net/man/8/ausearch)152- [OWASP Logging Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html)