CDS pluginCDS plugintypeInstalls into a CAP project and extends the runtime. CAP loads it through cds.requires or the plugin hook.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →

@cap-js/audit-logging

Integration with the SAP Audit Log service, so operations on personal data are recorded in the form an auditor expects without the application writing the entries.

Facts

Latestv1.3.0ReleasedLast pushLicenceApache-2.0

Where it sits

Lives in
Provides
LoggingCAPLoggingcapabilitySeeing what a running service did, in a form something can read afterwards — levels, a formatter that suits a laptop and one that suits a log service.Audit loggingCAPAudit loggingcapabilityRecording who touched personal or sensitive data, in a form an auditor accepts, without hand-writing it in every handler. It is often confused with application logging, which records what the code did rather than who accessed what.
Flavors
Requires
@sap/cds≥ 9@sap/cdsartifactThe peer range, as published.
Optional
SAP Audit Log serviceSAP Audit Log serviceartifactThe service the shipped integration writes audit logs to in production, which the README says needs a paid-for instance; an own implementation may write to a custom store instead.

Who is behind it

SAP Cloud Application Programming ModelSAP Cloud Application Programming ModelOrganisationMaintains this
In the atlas: maintains 34
@cap-js
maintainerAjinkya PatilPersonContributes to this
In the atlas: contributes to 112
@ajinkyapatil8190
Arley Triana MorinPersonContributes to this
In the atlas: contributes to 9, wrote 1
@arleytm
Christian GeorgiPersonContributes to this
In the atlas: maintains 1, contributes to 53
@chgeo
Christian SchüringsPersonContributes to this
In the atlas: contributes to 25
@cschuerings
Daniel HutzelPersonContributes to this
In the atlas: contributes to 32, wrote 3
@danjoa
Dr. David A. KunzPersonContributes to this
In the atlas: contributes to 16
@David-Kunz
Guilherme DellagustinPersonContributes to this
In the atlas: contributes to 27
@dellagustin-sap
Nikolay GrechanovPersonContributes to this
In the atlas: contributes to 1
@grenik
Heiko WitteborgPersonContributes to this
In the atlas: contributes to 18
@hm23
Johannes VogelPersonContributes to this
In the atlas: contributes to 25
@johannes-vogel
25 contributors

Before choosing this

Conditions

LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2, 3A cds-plugin is used with SAP CAP materials, or an artifact is explicitly identified as a CAP plugin or application.
  • § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
  • § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.
  • § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
SAP Developer License Agreement 3.2 CAP →

What it declares

Every artifact

Type
CDS plugin
Origin
By SAP

As a CDS plugin

Declared for
>=9
Distributed through
npm

Connections4

@cap-js/audit-logging connections@cap-js/audit-loggingPROVIDES→ provides2provides authoredAudit loggingprovides authoredLoggingNEEDS→ connects to1connects to stated If: The plugin's own integration is used; an own implementation may write the audit logs to a custom store instead. Writing the audit log messages a CAP application produces, the personal data ones derived from annotations included, to the SAP Audit Log service, the integration the plugin ships; an own implementation may write them to a custom store instead. @cap-js/audit-logging — README: https://raw.githubusercontent.com/cap-js/audit-logging/dde46b2b15298a3b756d697a8c6f2eb8becf4d35/README.md cap-js/audit-logging — README, In Production: https://raw.githubusercontent.com/cap-js/audit-logging/dde46b2b15298a3b756d697a8c6f2eb8becf4d35/README.mdSAP Audit Log serviceif→ optionally needs1optionally needs stated If: The plugin's own integration is used; an own implementation may write the audit logs to a custom store instead. The service the shipped integration writes audit logs to in production, which the README says needs a paid-for instance; an own implementation may write to a custom store instead. cap-js/audit-logging — README, In Production: https://raw.githubusercontent.com/cap-js/audit-logging/dde46b2b15298a3b756d697a8c6f2eb8becf4d35/README.md cap-js/audit-logging — README, In Production: https://raw.githubusercontent.com/cap-js/audit-logging/dde46b2b15298a3b756d697a8c6f2eb8becf4d35/README.mdSAP Audit Log serviceif

Install

npm add @cap-js/audit-logging

Derived from the package name. No recipe recorded; the README has the configuration.

Learn more2

Readings
  1. Implementing Custom Audit Logging in SAP CAP Applicationsgopalanand, SAP Community
  2. How to implement SAP BTP Audit log service in a CAP ApplicationKrishnaSharma7, SAP Community
What changed
  1. v1.3.0

    Support for @sap/cds 8 is dropped; the plugin needs @sap/cds 9 or later.

    Makes stale:

    Setup notes that add the plugin to a CAP 8 project.

1 earlier
  1. v0.1.0

    Logs are written with audit.log() and audit.logSync() against the SAP Audit Log Service REST API instead of through the @sap/audit-logging client library. The events dataAccessLog, dataModificationLog, configChangeLog and securityLog are removed, @AuditLog.Operation annotations are ignored, and reading sensitive data is logged only when cds.requires['audit-log'].handle includes READ.

    Makes stale:

    Guides that set cds.features.audit_personal_data: true, annotate entities with @AuditLog.Operation, or expect reads of sensitive data to be logged by default.

Where it sits in your app

Download
Your CAP applicationYour SAP BTP subaccount@cap-js/audit-logging — README, checked 2026-09-19: “`@cap-js/audit-logging` is a CDS plugin providing integration to the SAP Audit Log service as well as out-of-the-box personal data-related audit logging based on annotations.”connectsif The plugin's ownintegration is used; an ownimplementation may write the aud…@cap-js/audit-logging, module@cap-js/audit-loggingSAP Audit Log service, service instanceSAP Audit Logservice
SAPnot SAP's, or the project's ownstated in the document

README

quoted from cap-js/audit-logging under Apache-2.0, read
cap-js/audit-logging/README.mdOn GitHub

Welcome to @cap-js/audit-logging

REUSE status

@cap-js/audit-logging is a CDS plugin providing integration to the SAP Audit Log service as well as out-of-the-box personal data-related audit logging based on annotations.

Documentation can be found at cap.cloud.sap.

Important

The information in this file is by no means complete but enables you to get started quickly. Make sure to read the provided documentation at cap.cloud.sap to get the full picture.

Preliminaries

In this guide, we use the Incidents Management reference sample app as the base to add change tracking to. Clone the repository and apply the step-by-step instructions:

git clone https://github.com/cap-js/incidents-app
cd incidents-app
npm i

Setup

To enable audit logging, simply add this self-configuring plugin package to your project:

npm add @cap-js/audit-logging

Annotate Personal Data

Identify entities and elements (potentially) holding personal data using @PersonalData annotations. Create a db/data-privacy.cds file and add the following:

using { sap.capire.incidents as my } from './schema';

annotate my.Customers with @PersonalData : {
  DataSubjectRole : 'Customer',
  EntitySemantics : 'DataSubject'
} {
  ID           @PersonalData.FieldSemantics: 'DataSubjectID';
  firstName    @PersonalData.IsPotentiallyPersonal;
  lastName     @PersonalData.IsPotentiallyPersonal;
  email        @PersonalData.IsPotentiallyPersonal;
  phone        @PersonalData.IsPotentiallyPersonal;
  creditCardNo @PersonalData.IsPotentiallySensitive;
};

annotate my.Addresses with @PersonalData: {
  EntitySemantics : 'DataSubjectDetails'
} {
  customer      @PersonalData.FieldSemantics: 'DataSubjectID';
  city          @PersonalData.IsPotentiallyPersonal;
  postCode      @PersonalData.IsPotentiallyPersonal;
  streetAddress @PersonalData.IsPotentiallyPersonal;
};

annotate my.Incidents with @PersonalData : {
  EntitySemantics : 'Other'
} {
  customer @PersonalData.FieldSemantics: 'DataSubjectID';
};

Learn more about the annotations in capire:

Test-Drive Locally

You've prepared everything to log personal data-related events. Let's see that in action.

Start the server as usual:

cds watch

Send an update request that changes personal data:

PATCH http://localhost:4004/odata/v4/admin/Customers('1004155')
Authorization: Basic alice:in-wonderland
Content-Type: application/json

{
  "firstName": "Danny",
  "lastName": "Joules"
}

See the audit logs in the server's console output:

[audit-log] - PersonalDataModified: {
  data_subject: {
    id: { ID: '1004155' },
    role: 'Customer',
    type: 'AdminService.Customers'
  },
  object: {
   type: 'AdminService.Customers',
   id: { ID: '1004155' }
  },
  attributes: [
    { name: 'firstName', old: 'Daniel', new: 'Danny' },
    { name: 'lastName', old: 'Watts', new: 'Joules' }
  ],
  uuid: '71fa93d9-c993-405f-ba1b-a9ef42668199',
  tenant: 't1',
  user: 'alice',
  time: 2023-02-26T08:13:48.287Z
}

In Production

The end-to-end out-of-the-box functionality provided by this plugin requires a paid-for instance of the SAP Audit Log service for customers. However, it is possible to provide an own implementation that writes the audit logs to a custom store.

Learn more about using the SAP Audit Log service.

Learn more about custom audit logging.

Support, Feedback, Contributing

This project is open to feature requests/suggestions, bug reports etc. via GitHub issues. Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.

Code of Conduct

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.

Licensing

Copyright 2023 SAP SE or an SAP affiliate company and contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.

Apache-2.0, read

History

Latest

v1.3.0dated in the atlas

Removed 1

Notes
Removed
  • Dropped CDS 8 support; minimum supported version is now @sap/cds@>=9
  1. v1.2.2

    Fixes 2

    Notes
    Fixed
    • Properly encode request body parameters using in audit-log-to-restv2
    • Resolved server crash when @PersonalData annotations are applied to composition targets whose DataSubject is only reachable via the parent entity's sibling association
  2. v1.2.1

    Fixes 2

    Notes
    Fixed
    • Updated the audit log service plan detection logic to support the new URL format
    • The absence of req.target does not lead to an error
  3. v1.2.0

    Changed 3

    Notes
    Changed
    • Adjusted auto-detection of kind audit-log-to-als to now check for a VCAP service name matching "auditlog-ng"
    • Adjusted how the handlers for emitting audit logs are registered to support feature toggle and extensibility scenarios.
    • Improved debug logging in cases where emitting audit log fails
  4. v1.1.1

    Fixes 1

    Notes
    Fixed
    • Data subject lookup when data subject is not exposed in the same service
  5. v1.1.0

    Features 1, Fixes 1

    Notes
    Added
    • audit-log-to-alsng: Support for sending generic audit log events
    Fixed
    • audit-log-to-alsng: Correctly retrieve appId from the VCAP_APPLICATION environment variable
  6. v1.0.1

    Fixes 1

    Notes
    Fixed
    • audit-log-to-alsng: EventDataPayload to Support Multi-Key Object and DataSubject IDs
  7. v1.0.0

    Features 1

    Notes
    Added
    • Beta support for next generation SAP Audit Log Service
      • Use explicit kind audit-log-to-alsng or alpha auto-detect kind audit-log-to-als
  8. v0.9.0

    Features 1

    Notes
    Added
    • Support for @sap/cds^9
  9. v0.8.3

    Fixes 1

    Notes
    Fixed
    • Preperation for @sap/cds^9
  10. v0.8.2

    Fixes 3

    Notes
    Fixed
    • Erroneous modification log for non-updated key properties
    • Error during non-modifying queries on database level
    • Specify charset UTF-8 for requests to SAP Audit Log Service
  11. v0.8.1

    Fixes 2

    Notes
    Fixed
    • Support for @sap/cds^8.2
    • Reduce clutter in error raised for outbound requests
  12. v0.8.0

    Features 1, Changed 1

    Notes
    Added
    • Allow to specify undefined tenant in order to log to provider account in multi-tenant scenarios
    Changed
    • Use kind audit-log-to-restv2 in profile hybrid
  13. v0.7.0

    Features 1

    Notes
    Added
    • Automatically promote entities that are associated with data subjects
  14. v0.6.0

    Features 1, Fixes 2

    Notes
    Added
    • Support for @sap/cds^7.5
    Fixed
    • Automatic personal data modification logging for data subject details with renamed keys
    • Data subject resolution in circular models
  15. v0.5.2

    Fixes 1

    Notes
    Fixed
    • Automatic personal data modification logging for deep data structures with renamings
  16. v0.5.1

    Fixes 1

    Notes
    Fixed
    • Falsy early exit during bootstrapping in case a service does not contain personal data
  17. v0.5.0

    Features 1

    Notes
    Added
    • Common log entry fields uuid, tenant, user and time can be provided manually
  18. v0.4.0

    Features 3, Changed 1, Fixes 1

    Notes
    Added
    • Support for Premium plan of SAP Audit Log Service
    • Support for XSUAA credential type x509
    • Support for generic outbox
    Changed
    • Always use outbox (as configured in project)
    Fixed
    • Avoid dangling SELECTs to resolve data subject IDs, which resulted in "Transaction already closed" errors
  19. v0.3.2

    Fixes 1

    Notes
    Fixed
    • If the request has no tenant (e.g., Unauthorized), the audit log shall be sent to the provider account
  20. v0.3.1

    Fixes 2

    Notes
    Fixed
    • Defaulting of @PersonalData.DataSubjectRole to entity name
    • Overriding service configuration
  21. v0.3.0

    Changed 1

    Notes
    Changed
    • Default value for cds.requires['audit-log'].handle changed to ['READ', 'WRITE'], i.e., accessing sensitive data is now logged by default.
  22. v0.2.0

    Features 1

    Notes
    Added
    • Export class AuditLogService for extending in custom implementations as follows:
      const { AuditLogService } = require('@cap-js/audit-logging')
      class MyAuditLogService extends AuditLogService {
        async init() {
          [...]
          // call AuditLogService's init
          await super.init()
        }
      }
      module.exports = MyAuditLogService
  23. v0.1.0dated in the atlas

    Removed 3, Features 4, Changed 2, Fixes 1

    Notes
    Added
    • New API:
      • await audit.log('<event>', <data>) for asynchronous logs (cf. emit)
      • await audit.logSync('<event>', <data>) for synchronous logs (cf. send)
    • New REST API-based schema with auto-filled LogEntry aspect
    • New events SensitiveDataRead, PersonalDataModified, ConfigurationModified, and SecurityEvent
    • Full support for OAuth2 plan of SAP Audit Log Service
    Changed
    • Whether reading sensitive data and modifying personal data is logged is determined by cds.requires['audit-log'].handle: [...]. Possible values in the array are READ and/ or WRITE, with WRITE as the sole default entry. Hence, accessing sensitive data is not logged by default.
    • Integration with SAP Audit Log Service via REST API instead of client library (@sap/audit-logging)
    Fixed
    • Various glitches in log calculation
    Removed
    • Old events dataAccessLog, dataModificationLog, configChangeLog, and securityLog
    • @AuditLog.Operation annotations are ignored. Having the plugin as dependency signals the intent to audit log.
    • cds.features.audit_personal_data: true is no longer necessary. Instead, simply add the plugin as a dependency.
2,152downloads per week, npm
Weekly downloads for @cap-js/audit-logging26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 2152.27 Apr – 3 May: 5,1514 May – 10 May: 7,08211 May – 17 May: 6,40118 May – 24 May: 6,65025 May – 31 May: 5,7781 Jun – 7 Jun: 4,1208 Jun – 14 Jun: 7,56015 Jun – 21 Jun: 10,92122 Jun – 28 Jun: 8,57529 Jun – 5 Jul: 9,1786 Jul – 12 Jul: 8,27413 Jul – 19 Jul: 7,92520 Jul – 26 Jul: 8,90127 Jul – 2 Aug: 9,8363 Aug – 9 Aug: 10,55510 Aug – 16 Aug: 9,23417 Aug – 23 Aug: 10,46024 Aug – 30 Aug: 9,55831 Aug – 6 Sept: 9,1147 Sept – 13 Sept: 8,38714 Sept – 20 Sept: 9,91121 Sept – 27 Sept: 9,59428 Sept – 4 Oct: 11,1705 Oct – 11 Oct: 9,18512 Oct – 18 Oct: 7,06919 Oct – 25 Oct: 2,152

Others providing5

Logging
  1. SAP Application Logging service for SAP BTPCollects Cloud Foundry or Kyma logs into a searchable Kibana
  2. com.sap.cds:cds-services-bomMaven bill of materials pinning CAP Java module versions
Audit logging
  1. SAP Audit Log serviceIngests and retains compliance audit data from BTP
  2. com.sap.cds:cds-feature-auditlog-ngCAP Java plugin sending audit log events to SAP Audit Log service
  3. com.sap.cds:cds-feature-auditlog-v2CAP Java handler for SAP Audit Log service API version 2
  4. com.sap.cds:cds-services-bomMaven bill of materials pinning CAP Java module versions

Details

Sources5
npm registrydiscovered herechecked
The discovery passdiscovered herechecked
npm registry, @cap-js/audit-loggingversion, releases, installschecked
github.com/git+https://github.com/cap-js/audit-logging.gittree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
declared for>=9
latestv1.3.0
first release
releases and cadence24, ~49d median
discovered vianpm registry, The discovery pass
first seen in the atlas
ecosystem and domaincap, operations-and-runtime
Flavors1
Node.js
“npm add @cap-js/audit-logging” — cap-js/audit-logging — READMEchecked
Contributors25
History in the atlas4
  1. The plugin's own integration is used; an own implementation may write the audit logs to a custom store instead.
  2. The plugin required the Audit Log service and said nothing of what passes between them.
  3. Integration with the SAP Audit Log service, so operations on personal data are recorded in the form an auditor expects without the application writing the entries.
  4. First seen.
For your agent
Ref
artifact:cap-js-audit-logging
JSON
/artifacts/cap-js-audit-logging.json
MCP
Connecting an agent