SAP HANA Audit Trail
SAP HANA audit trail of a production S/4HANA tenant — logon and credential checks, data access on the application schema, authorization and user administration, configuration and license changes, certificate, authentication-provider and encryption-key management, backups, and the audit policy changes HANA always records itself. Every event keeps the trail line HANA writes verbatim in `message` beside the same values parsed into ECS.
Quick Start
uv tool install eventum-generator
git clone https://github.com/eventum-generator/content-packs.git
cd content-packs
eventum generate \
--path generators/database-sap-hana/generator.yml \
--id hana \
--live-mode trueEvent Types
| Event ID | Description | Frequency | Category |
|---|---|---|---|
| SELECT | Reads on the application schema, the calculation views and the SYS system views | ~55% | database |
| VALIDATE USER | Credential check, audited before the session exists | ~10% | authentication |
| CONNECT | Accepted connection, opening a session later events run in | ~8% | authentication |
| INSERT / UPDATE / DELETE | Writes on the application tables, refused for read-only reporting accounts | ~8% | database |
| EXECUTE | Stored procedure calls, including the repository procedures that grant activated roles | ~5% | database |
| GRANT / REVOKE | System and object privileges and repository or catalog roles, with the grant option | ~4% | iam |
| USER / ROLE / USERGROUP | Users, roles and user groups created, changed and dropped, with passwords masked | ~3% | iam |
| CONNECT (refused) | Rejected logon, naming the reason: wrong credentials, locked, deactivated, expired | ~2% | authentication |
| SYSTEM CONFIGURATION CHANGE | Parameter changes carrying the previous value, service stops and license installation | ~1.6% | configuration |
| BACKUP / RECOVER | Manual complete, incremental and differential backups, catalog deletion, recovery | ~1.2% | database |
| AUDIT POLICY | Audit policies created, changed and dropped and audit entries deleted, always at critical level | ~1.1% | configuration |
| SECURITY OBJECTS | Certificate collections and certificates, LDAP / SAML / JWT providers, client-side encryption keys | ~0.8% | configuration |
Realism Features
- Raw trail line preserved — `message` carries the 38-position audit entry the syslog trail target writes, so a parser can be developed against it while dashboards read the parsed `sap.hana.audit.*` fields
- Audit actions verified against SAP — 48 of the 52 actions come from the auditable set of CREATE AUDIT POLICY, and the four audit-policy actions are the ones HANA always records under MandatoryAuditPolicy
- Policies from the Security Guide — events are reported under the `_SAP_*` policy set SAP recommends, at the levels it assigns, plus the site policies a production system adds for data access
- Logon pairs — a credential check is followed by the connection it authorises or the refusal it causes, sharing session ID, account and client
- Sessions — an accepted connection opens a session that later statements run inside, reusing its ID, account, client host and process; the pools are bounded and sessions retire
- Account lockout — invalid attempts accumulate per account and the sixth reports "user is locked", matching HANA's default maximum_invalid_connect_attempts
- Who does what — application servers send prepared statements with placeholders, loaders read column ranges by delta key, a person at HDB Studio reads whole rows, monitoring accounts read the system views
- Application users — the ABAP stack connects as one technical account and passes the business user through, so the database user and the application user differ
- Sensitivity drives the policy — reads of the HR and password tables are reported by their own policy at warning level, the rest of the schema at info
- Intrusion arc — about 7% of events form a six-phase story: password spraying from an unmanaged host, the connection the guessed credentials open, a backdoor account and privilege grants, bulk reads of the HR and password tables, then audit policy changes and an audit log deletion that MandatoryAuditPolicy records anyway
Sample Output
{
"@timestamp": "2026-07-31T09:18:35.225797+00:00",
"message": "2026-07-31T09:18:35.225797Z;indexserver;hana-prod-01.corp.local;HDB;00;30040;HDB_PROD;10.20.9.6;jump02.corp.local;13653;57962;_SAP_authorizations;INFO;GRANT ROLE;SUPPORT_L3;;;;GRANTABLE;Z_S4_HR_DISPLAY;Z_ETL_LOAD;SUCCESSFUL;;;;;;;GRANT \"Z_S4_HR_DISPLAY\" TO Z_ETL_LOAD WITH ADMIN OPTION;400018;SUPPORT_L3;_SYS_REPO;_SYS_REPO;;;;hdbsql;SUPPORT_L3",
"event": {
"action": "grant_role",
"category": ["iam"],
"dataset": "sap_hana.audit",
"kind": "event",
"module": "sap_hana",
"outcome": "success",
"severity": 6,
"type": ["group", "change"]
},
"rule": { "name": "_SAP_authorizations", "ruleset": "SAP HANA audit policies" },
"sap": {
"hana": {
"audit": {
"action": "GRANT ROLE",
"action_status": "SUCCESSFUL",
"audit_level": "INFO",
"database_name": "HDB_PROD",
"grantable": "GRANTABLE",
"policy_name": "_SAP_authorizations",
"role_name": "Z_S4_HR_DISPLAY",
"role_schema_name": "_SYS_REPO",
"session_id": 400018,
"session_user": "SUPPORT_L3",
"target_principal": "Z_ETL_LOAD"
}
}
},
"source": { "domain": "jump02.corp.local", "ip": "10.20.9.6", "port": 57962 },
"user": {
"name": "SUPPORT_L3",
"roles": ["Z_S4_HR_DISPLAY"],
"target": { "name": "Z_ETL_LOAD" }
}
}Parameters
| Parameter | Default | Description |
|---|---|---|
| hana_sid | HDB | System ID of the audited instance |
| hana_instance | 00 | Instance number |
| hana_host | hana-prod-01.corp.local | Fully qualified host name of the audited instance |
| hana_ip | 10.20.4.11 | Host address |
| hana_port | 30040 | Port of the service that reports the action |
| hana_service | indexserver | Service that reports the action |
| tenant_db | HDB_PROD | Tenant database name |
| hana_version | 2.00.077.00.1707118848 | Database version, reported in service.version |
| hana_host_id | 4f2c9a17be3d4e8f9c05a1d76b3e8420 | Machine ID of the host |
| hana_mac | 00-50-56-A1-3F-2C | Host MAC address |
| hana_os_version | 15 SP5 | Operating system version |
| hana_os_kernel | 5.14.21-150500.55.83-default | Kernel release |
| backup_path | /hana/backup/HDB | Directory manual backups are written to |
| rogue_subnet | 10.99.0.0/16 | Range the intruder connects from, outside the managed client ranges |
| ecs_version | 8.11.0 | ECS version reported in ecs.version |
Related Generators
Microsoft SQL Server Audit
SQL Server Audit via Windows Event ID 33205 — login/logout lifecycle, DML queries (SELECT/INSERT/UPDATE/DELETE), stored procedure execution, schema changes (CREATE/ALTER/DROP), permission management (GRANT/DENY/REVOKE), role membership, backups, DBCC commands, and password changes.
MySQL Audit
MySQL Enterprise Audit Plugin events (ECS-compatible JSON) covering all four audit classes — connection, general, table_access, and audit. Generates connect/disconnect lifecycle, DML queries (SELECT/INSERT/UPDATE/DELETE), table access tracking, DDL schema changes, GRANT/REVOKE privileges, admin commands, query errors, and failed authentication attempts with realistic query statistics.
PostgreSQL Audit Logs
PostgreSQL with pgAudit — SELECT/INSERT/UPDATE/DELETE queries with parameterized statements, connection lifecycle, authentication failures, DDL operations, role management (GRANT/REVOKE), and database errors (deadlocks, constraint violations).