# Auditing

ESS auditing provides comprehensive activity monitoring to manage risks. ESS services support the auditing of their activities.

{% hint style="info" %}
For information on the ESS Auditing Service, see [https://docs.inrupt.com/ess/latest/services/service-auditing/](https://docs.inrupt.com/ess/latest/services/service-auditing/ "mention")
{% endhint %}

## Audit Events

The following events are audited:

| Services                                                                                | Event Name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Notes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Most Services                                                                           | <ul><li><strong><code>service-started</code></strong></li><li><strong><code>service-shutdown</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Service Startup/Shutdown.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Purgeable services (i.e. Access Grant, Authorization, Broker, Pod Provision, and WebID) | <ul><li><strong><code>purge-init</code></strong></li><li><strong><code>purge-completed</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Purge start/complete.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Access Grant Service                                                                    | <ul><li><strong><code>access-grant-created</code></strong></li><li><strong><code>access-grant-queried</code></strong></li><li><strong><code>access-grant-read</code></strong></li><li><strong><code>access-grant-revoked</code></strong></li><li><strong><code>access-grant-verified</code></strong></li><li><strong><code>access-request-created</code></strong></li><li><strong><code>access-request-read</code></strong></li><li><strong><code>access-request-revoked</code></strong></li><li><strong><code>access-request-verified</code></strong></li><li><strong><code>access-denial-created</code></strong></li><li><strong><code>access-denial-read</code></strong></li><li><strong><code>access-denial-revoked</code></strong></li><li><strong><code>access-denial-verified</code></strong></li><li><strong><code>request-authorized</code></strong></li><li><strong><code>revocation-status-read</code></strong></li></ul> | <p>Access Request/Grant/Denial lifecycle events.<br><br><strong><code>request-authorized</code></strong> events contain additional information (such as the access grant service endpoint, the WebID, client id, etc.) for <strong>authenticated</strong> access requests/grants/denial events. For these events, you can find the corresponding <strong><code>request-authorized</code></strong> event using the instrument field. However, other than the service endpoint, the same information may be found in the <strong><code>access-\*</code></strong> event messages themselves.<br><br>As part of the access grant to UMA access token exchange (which is an <strong>unauthenticated</strong> event), <strong><code>revocation-status-read</code></strong> events occur. These <strong><code>revocation-status-read</code></strong> events, which are also <em>unauthenticated</em>, do not have an associated <strong><code>request-authorized</code></strong> event.</p> |
| Authorization Service                                                                   | <ul><li><strong><code>acr-created</code></strong></li><li><strong><code>acr-updated</code></strong></li><li><strong><code>acr-deleted</code></strong></li><li><strong><code>provisioned-pod-access-control</code></strong></li><li><strong><code>deprovisioned-pod-access-control</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | ACR Lifecycle events.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Pod Storage Service                                                                     | <ul><li><strong><code>resource-created</code></strong></li><li><strong><code>resource-updated</code></strong></li><li><strong><code>resource-deleted</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Resource Lifecycle events.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|                                                                                         | <ul><li><strong><code>resource-read</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | <p>Successful resource read events (<strong><code>GET</code></strong> and <strong><code>HEAD</code></strong> operations).</p><p>To enable, see <a href="https://docs.inrupt.com/ess/latest/services/service-pod-management/service-pod-storage.md#inrupt_storage_audit_resource_read_enabled"><strong><code>INRUPT\_STORAGE\_AUDIT\_RESOURCE\_READ\_ENABLED</code></strong></a> configuration for <a href="https://docs.inrupt.com/ess/latest/services/service-pod-management/service-pod-storage.md">Pod Storage Service.</a></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Pod Provision Service                                                                   | <ul><li><strong><code>pod-provisioned</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Pod Provisioned event.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Purger application                                                                      | <ul><li><strong><code>purge-started</code></strong></li><li><strong><code>purge-completed</code></strong></li><li><strong><code>purge-failed</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Purge start/end (successful or not).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Query Service                                                                           | <ul><li><strong><code>query-succeeded</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Query events.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Query Indexer                                                                           | <ul><li><strong><code>ingest-succeeded</code></strong></li><li><strong><code>ingest-failed</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Query Indexer events.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Solid OIDC Broker Service                                                               | <ul><li><strong><code>openid-backend-idp-login</code></strong></li><li><strong><code>openid-token-requested</code></strong></li><li><strong><code>openid-authorization-initialized</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Authentication/Authorization flow.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| UMA Service                                                                             | <ul><li><strong><code>uma-token-created</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | UMA Grant Flow.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| WebID Service                                                                           | <ul><li><strong><code>webid-created</code></strong></li><li><strong><code>webid-updated</code></strong></li><li><strong><code>webid-deleted</code></strong></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | WebID Profile events.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

The following services do not produce audit events:

* Notification Gateway service
* WebSocket Notification service
* Start service

{% hint style="info" %}
ESS uses asynchronous messaging for auditing.
{% endhint %}

#### Audit Event Message Internal Format

Internally, ESS’ audit event messages are in RDF and serialized as [ActivityStreams 2.0](https://www.w3.org/TR/activitystreams-core/) JSON-LD documents:

{% hint style="info" %}
Although the following document shows all possible fields for an event message, the specific events determine which fields appear.

Pod-related event messages include:

* the actor information ([WebID](https://docs.inrupt.com/reference/glossary#webid))
* the application information ([Client ID](https://docs.inrupt.com/reference/glossary#client-identifier))
* the Pod information (Pod root URL and Pod data subject)
  {% endhint %}

```json
{
   "@context":[
      "https://www.w3.org/ns/activitystreams",
      "https://schema.inrupt.com/audit/v1.jsonld"
   ],
   "id":"<UUID of the event>",
   "type": [ "Activity", <type2>,... ],
   "name":"<event name>",
   "summary": "<event description>",
   "generator": <JSON document identifying the software producing the event>,
   "actor": [ <JSON document identifying the actor associated with the event>, ... ],
   "object": [ <JSON document identifying the object associated with the event>, ... ],
   "instrument": [ <JSON document identifying the client/application associated with the event>,
                   <JSON document with associated OpenTelemetry data>,
                   <JSON document with associated application-defined metadata>,
                   <JSON document identifying the Pod root and data subject>, ... ],
   "result": [ <JSON document containing associated results for the event, if any> ],
   "published": "<datetime>",
   "identifier":"<identifier to use for correlated events>"
}
```

<table data-header-hidden><thead><tr><th width="142"></th><th></th></tr></thead><tbody><tr><td><strong><code>@context</code></strong></td><td>Specifies the JSON-LD contexts.</td></tr><tr><td><strong><code>id</code></strong></td><td>Universally Unique IDentifier (UUID) for the event.</td></tr><tr><td><strong><code>type</code></strong></td><td>An array of event types; e.g., <strong><code>[ "Activity", "Create" ]</code></strong>.</td></tr><tr><td><strong><code>name</code></strong></td><td>Name that denotes the event; e.g., <strong><code>service-started</code></strong>, <strong><code>openid-backend-idp-login</code></strong>, <strong><code>resource-created</code></strong>, <strong><code>access-grant-created</code></strong>, etc.</td></tr><tr><td><strong><code>summary</code></strong></td><td>Short description associated with the message <strong><code>name</code></strong>.</td></tr><tr><td><strong><code>generator</code></strong></td><td><p>JSON document identifying the software (e.g., service) producing the event. For example, the <strong><code>generator</code></strong> for a Pod provision event:</p><pre class="language-json"><code class="lang-json">"generator": {
   "id": "&#x3C;service URL>"
   "type": ["SoftwareApplication"],
   "name": "&#x3C;application name>",
   "qualifiedAssociation": "&#x3C;processId>",
   "wasAssociatedWith": "&#x3C;Kubernetes pod name>"
}
</code></pre></td></tr><tr><td><strong><code>actor</code></strong></td><td><p>An array of JSON documents that identify the agents, if any, associated with the event. The actor’s identity can be denoted by various combination of fields, such as (list below is not exhaustive):</p><ul><li><strong><code>id</code></strong> and <strong><code>type</code></strong> fields;</li><li><strong><code>name</code></strong> and <strong><code>type</code></strong> fields.</li></ul><p>The field can also be empty <strong><code>[]</code></strong> for events not initiated by a user (such as service start events, etc.).</p><p><br><strong><code>id</code></strong> and <strong><code>name</code></strong> fields are associated with a <strong><code>type</code></strong> field.<br></p><p>For example:</p><ul><li><p>For an Access Request/Grant event, which include the <strong><code>id</code></strong> and the <strong><code>type</code></strong>:</p><pre class="language-json"><code class="lang-json">"actor" : [
   {
      "id" : "https://id.example.com/someusername",
      "type" : [
         "Agent"
      ]
   }
],
</code></pre></li><li><p>For IdP login events:</p><pre class="language-json"><code class="lang-json">"actor": [
   {
      "name": "someusername",
      "type" : [
         "Agent"
      ]
   }
]
</code></pre></li></ul></td></tr><tr><td><strong><code>object</code></strong></td><td><p>An array of JSON documents that identify the objects associated with the event; that is, the objects against which the action is performed.</p><p>The object can be denoted by various combination of fields, such as (list below is not exhaustive):</p><ul><li><strong><code>id</code></strong> and <strong><code>name</code></strong> fields;</li><li><strong><code>id</code></strong> and <strong><code>type</code></strong> fields;</li><li><strong><code>name</code></strong> and <strong><code>qualifiedAssociation</code></strong> fields;</li></ul><p>For example:</p><ul><li><p>A Pod provisioned event:</p><pre class="language-json"><code class="lang-json">"object": [
   { "type": [ "Storage" ], "id": "&#x3C;Pod Root URL>" }
]
</code></pre></li><li><p>For Access Request/Grant/Denial creation events, the <strong><code>object</code></strong> field contains the created Access Request/Grant/Denial:</p><ul><li><p>The <strong><code>object</code></strong> for the create Access Request/Grant/Denial events contains the created Request/Grant/Denial in a document with:</p><ul><li>the <a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-content">content</a> field that contains the Access Request/Grant/Denial as string and</li><li>the <a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-mediatype">mediaType</a> field.</li></ul><p>Previously, the <strong><code>object</code></strong> contained the created Access Request/Grant/Denial directly as an element.</p></li><li>The <strong><code>object</code></strong> contains an element that identifies the Pod resource.</li></ul><pre class="language-json"><code class="lang-json">"object": [
   {
     "content" : "{\"id\":\"https://vc.example.com/vc/79288a3 ... }",
     "mediaType": "application/ld+json"
   },
  {
    "type" : [
      "Resource"
    ],
    "id" : "https://storage.example.com/ad3b.../some/resource"
  }
]
</code></pre></li><li><p>For Pod resource CRUD events ( <strong><code>resource-created</code></strong>, <strong><code>resource-read</code>,</strong> <strong><code>resource-updated</code></strong>, and <strong><code>resource-deleted</code></strong>) events, the <strong><code>object</code></strong> field include an object that identifies the Pod resource.<br></p><p>For example:</p><pre class="language-json"><code class="lang-json">"object": [
    {
        "generated" : "6cba8240-9f79-40db-a129-c6b8edddb840",
        "invalidated" : "4e12ed06-c4e5-41bc-bcd3-0f6a821c08ca",
        "type" : [
            "Resource"
        ],
        "id" : "https://storage.example.com/ad3b.../some/resource"
    }
]
</code></pre><p><br>The <strong><code>generated</code></strong> and <strong><code>invalidated</code></strong> fields are internal references to the content that appear in some combination depending on whether it’s a create/read/update/delete event.<br></p><p>The object may also include additional fields, such as <strong><code>accessControl</code></strong> for <strong><code>resource-created</code></strong> events.</p></li></ul></td></tr><tr><td><strong><code>instrument</code></strong></td><td><p>An array of JSON documents that identify:</p><ul><li><p>The clients associated with the event, if any. For example:</p><pre class="language-json"><code class="lang-json">"instrument" : [
    {
        "id" : "https://start.example.com/app/id",
        "summary" : "Client identifier",
    }
],
</code></pre><p><br>Instrument objects that identify the clients have an associated <strong><code>summary</code></strong> field with the value <strong><code>"Client identifier"</code></strong>.</p><p>Some events such as <strong><code>service-started</code></strong> do not have associated clients, and thus may have empty <strong><code>instrument</code></strong> array.</p></li><li><p>The associated <a href="https://opentelemetry.io/docs/what-is-opentelemetry/">OpenTelemetry</a> instrument info</p><p>For example:</p><pre class="language-json"><code class="lang-json">"instrument" : [
    // ...
    {
        "traceId" : "7decd3657a9efffc010a4b6a4b3da586",
        "spanId" : "91123fce3c668451",
        "isSampled" : true,
        "name" : "OpenTelemetry Span Context",
        "type" : [
            "SpanContext"
        ]
    },
// ...
],
</code></pre><p>OpenTelemetry <strong><code>traceId</code></strong> field can be used to correlate messages associated with a request. See <a data-mention href="auditing/appendix-audit-event-correlation">appendix-audit-event-correlation</a> for more information.</p></li><li><p>The associated Pod information:</p><ul><li><strong><code>hasDataSubject</code></strong> contains the Pod data subject information (Pod Data Subject refers to the agent who created the Pod. )</li><li><strong><code>hasStorage</code></strong> contains the Pod root URL.</li></ul><p>For example:</p><pre class="language-json"><code class="lang-json">"instrument" : [
    // ...
    {
        "hasDataSubject" : {
            "id" : "https://id.example.com/someusername",
            "type" : [
                "https://w3id.org/dpv#DataSubject"
            ]
        },
        "hasStorage" : "https://storage.example.com/root/",
        "type" : [
            "http://www.w3.org/2004/02/skos/core#Concept"
        ]
    }
    // ...
],
</code></pre></li><li><p><a href="https://docs.inrupt.com/ess/latest/administration/application-defined-metadata">Application-defined metadata</a> sent in client requests</p><p>For example:</p><pre class="language-json"><code class="lang-json">"instrument" : [
    // ...
    {
        "name" : "Application-Defined Request Metadata", 
        "items": [    
            {       
                "mediaType" : "text/plain",       
                "name" : "x-correlation-id",       
                "content" : "2049875809728750827498245084"    
            },    
            {       
                "mediaType": "text/plain",       
                "name": "my-client-version",       
                "content": "1.0.3"
            } 
        ], 
        "type": [    
            "urn:uuid:1a05e301-4013-40c9-bae7-5d719b7151c8" 
        ]
    }
    // ...
],
</code></pre><p>See <a href="https://docs.inrupt.com/ess/latest/administration/application-defined-metadata">Application-Defined Metadata</a> for the configuration needed to include in audit events.</p></li></ul></td></tr><tr><td><strong><code>result</code></strong></td><td><p>An array of JSON documents that contains associated results. For example:</p><ul><li>an <strong><code>access-request-verified</code></strong> event includes the results of the verification, or</li><li>an <strong><code>access-grant-revoked</code></strong> event includes the updated status.</li></ul></td></tr><tr><td><strong><code>published</code></strong></td><td>The timestamp of the event.</td></tr><tr><td><strong><code>identifier</code></strong></td><td>Identifier to use for correlated events from a <strong>single</strong> service that have occurred within the same request. To correlate events across services for a request, use the OpenTelemetry <strong><code>traceId</code></strong> in the <strong><code>instrument</code></strong> field.</td></tr></tbody></table>

For examples, see [appendix-audit-events-examples](https://docs.inrupt.com/security/auditing/appendix-audit-events-examples "mention")

### Integration with External Logging Systems

The ESS [Auditing Service](https://docs.inrupt.com/ess/latest/services/service-auditing/) can log to:

* **`sysout`** (default)
* Syslog
* [Microsoft Sentinel](https://azure.microsoft.com/en-us/services/microsoft-sentinel/#overview)

For more information, see [Integration with Syslog](https://docs.inrupt.com/ess/latest/services/service-auditing#integration-with-syslog) and [Integration with Sentinel](https://docs.inrupt.com/ess/latest/services/service-auditing#integration-with-sentinel).
