executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
sap-btp-audit-logSAP BTP Audit Log Service — audit trail capture, configuration, compliance (SOC 2, GDPR), audit log viewer, retention policies, OAuth audit integration. Use when implementing audit logging on BTP, configuring compliance audit trails, or capturing security-relevant events.
Independent GitHub snapshot · Automated classification · Original documentation governs
name: sap-btp-audit-log description: SAP BTP Audit Log Service — audit trail capture, configuration, compliance (SOC 2, GDPR), audit log viewer, retention policies, OAuth audit integration. Use when implementing audit logging on BTP, configuring compliance audit trails, or capturing security-relevant events. trigger:
Tamper-proof audit trails for SAP BTP applications — compliance, security, forensics.
cf login)@sap/cds ≥ 7.x (for code-level audit logging)# Create service instance
cf create-service auditlog standard my-auditlog
# Bind to your application
cf bind-service my-app my-auditlog
# Restage to pick up VCAP_SERVICES
cf restage my-app
const cds = require('@sap/cds')
module.exports = class OrderService extends cds.ApplicationService {
async init() {
this.after(['CREATE','UPDATE','DELETE'], 'Orders', (data, req) => {
req.audit({
category: 'data-modification',
object: { type: 'Order', id: data.ID },
user: req.user.id,
tenant: req.tenant,
attributes: [{ name: 'event', value: req.event }]
})
})
await super.init()
}
}
Audited event categories:
// xs-security.json
{
"xsappname": "my-audited-app",
"oauth2-configuration": {
"audit-logs": {
"enabled": true,
"events": ["token-issued", "token-refreshed", "token-revoked"]
}
}
}
# Deploy updated security descriptor
cds compile srv/ -2 xs-security.json > xs-security.gen.json
cf bind-service my-app my-xsuaa -c xs-security.gen.json
cf restage my-app
SAP BTP Cockpit → Subaccount → Audit Log Viewer
→ Filter by: time range, event type, user, tenant
→ Export: CSV, JSON
→ Retention: 30 days (free), 90 days (standard), 1 year (enterprise)
Alternatively, use the REST API:
# Fetch audit log entries (requires OAuth token from auditlog service key)
curl "https://auditlog-management.cfapps.<region>.hana.ondemand.com/auditlog/v1/auditlogrecords?time_from=2026-01-01T00:00:00Z" \
-H "Authorization: Bearer $AUDITLOG_TOKEN"
Pitfall: Audit logs are read-only after write
req.audit(). PII must be sanitized.Pitfall: Cannot view logs in cockpit
BTP Cockpit → Security → Role Collections → Add user to "Subaccount Auditor".Pitfall: Custom attributes not appearing in viewer
attributes array format changed across CAP versions.[{ name: 'key', value: 'val' }] format. Verify with cds --version ≥ 7.Pitfall: Logs disappear after 30 days
Pitfall: PII leaks into audit log
req.data wholesale. Mask email, phone, national IDs.# 1. Verify service instance exists and is bound
cf services | grep my-auditlog
# 2. Confirm binding in VCAP_SERVICES
cf env my-app | grep -A5 auditlog
# 3. Trigger an audited event (e.g., create an order via API)
curl -X POST https://my-app.cfapps.<region>.hana.ondemand.com/odata/v4/Orders \
-H "Content-Type: application/json" \
-d '{"ID":"123","total":100}'
# 4. Check Audit Log Viewer in BTP Cockpit — entry should appear within 60 seconds
# 5. Verify via REST API
curl "https://auditlog-management.cfapps.<region>.hana.ondemand.com/auditlog/v1/auditlogrecords" \
-H "Authorization: Bearer $AUDITLOG_TOKEN"