# Audit Logs APIs

This API is designed to extract detailed audit information from Data One.

It performs searches using precise matching criteria for all specified fields, ensuring that results are highly accurate. Additionally, audit records can be sorted either in ascending or descending order, depending on the record fields.

### Audit List

**Context**: /data-one-application/api/v1\
**Endpoint**: /audit/logs\
**Method**: GET\
**Description**: This API retrieves audit details in Data One. The search is executed with an exact matching for all fields. The audit records can be sorted in ascending/descending order, according to record fields.

**Parameters**:

| Parameters | Value                                 | Description                                                                                                                                     | Data type | Query type |
| ---------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ---------- |
| `page`     |                                       | Page start (mandatory)                                                                                                                          | string    | query      |
| `offset`   |                                       | Numeric offset page start (default=0)                                                                                                           | string    | query      |
| `limit`    |                                       | Number of entries (default=100)                                                                                                                 | string    | query      |
| `q`        | See the next paragraph                | Query parameter, entity-specific alias                                                                                                          | string    | query      |
| `sort`     | <p>+entityType </p><p>-entityType</p> | Fields to sort, prefixed with +/- (ascending/descending). If neither ascending nor descending order is configured, records are listed randomly. | string    | query      |

**Fields q parameter**

| Parameters       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`             | Record id                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `clusterId`      | STENG or CEMAN                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `correlationId`  | Correlated record id, for anti-tampering purposes                                                                                                                                                                                                                                                                                                                                                                                            |
| `nodeId`         | Node identifier                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `module`         | \<Ceman\_name> AUDIT                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `auditCode`      | <p>In the Audit module, the message code has the AUDnnnnA format, where: </p><ul><li>AUD: prefix for the Audit module</li><li>nnnn: number that identifies the specific message code </li><li>A: suffix that identifies the audit </li></ul><p>The complete list of message codes is on the <a href="/pages/MxsIfhcLIU2tShWaH06A">Audit Message Codes</a> page.</p>                                                                          |
| `auditOperation` | <p>The possible values are: </p><ul><li>CREATE </li><li>MODIFY </li><li>DELETE </li><li>LOGIN </li><li>LOGOUT </li><li>PASSWORD CHANGE </li><li>SERVER\_LOGIN </li><li>SERVER\_LOGOUT </li><li>SERVER\_CREATE\_DIR </li><li>SERVER\_CHANGE\_DIR</li><li>SERVER\_RENAME\_DIR </li><li>SERVER\_DELETE\_DIR </li><li>SERVER\_UPLOAD\_FILE </li><li>SERVER\_DOWNLOAD\_FILE </li><li>SERVER\_RENAME\_FILE </li><li>SERVER\_DELETE\_FILE</li></ul> |
| `dataoneUser`    | User that performs the operation.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `entityType`     | <p>This is the entity type, whose complete list is on the <a href="/pages/HQUt0TbiRCv3RfMXZafW">Entity Types</a> page. </p><p>For LOGIN or LOGOUT operations, the entity type is Ceman. </p><p>For the PASSWORD CHANGE operation, the entity type is Internal User or External User according to the type of the user to whom the password belongs.</p>                                                                                      |
| `entityName`     | <p>The entity name, entered by the user. </p><p>For LOGIN or LOGOUT operations, the entity is Ceman Cluster Name. </p><p>For the PASSWORD CHANGE operation, the entity is the username of the user to whom the password belongs.</p>                                                                                                                                                                                                         |
| `entityId`       | <p>ID of the entity. </p><p>For LOGIN or LOGOUT operations, the entity ID is the Ceman Node Name when the user performed the operation. </p><p>For the PASSWORD CHANGE operation, the entity ID is the entity ID of the user to whom the password belongs.</p>                                                                                                                                                                               |
| `auditMessage`   | The message displayed varies depending on the scenario.                                                                                                                                                                                                                                                                                                                                                                                      |
| `auditTime`      | Date and time when the audited operation occurred, as Timestamp.                                                                                                                                                                                                                                                                                                                                                                             |
| `fromAuditTime`  | Timestamp for range filtering.                                                                                                                                                                                                                                                                                                                                                                                                               |
| `toAuditTime`    | Timestamp for range filtering.                                                                                                                                                                                                                                                                                                                                                                                                               |

**Response**:

| HTTP Status code | Description                                                                                          |
| ---------------- | ---------------------------------------------------------------------------------------------------- |
| 200              | SUCCESS                                                                                              |
| 401              | Not authorized (login not performed or token expired).                                               |
| 4xx-5xx          | Bad request; details in the error message (i.e., mandatory fields not present or with wrong values). |

**Examples**

**Request:**

```
curl 'https\://ceman1:9443/data-one-application/api/v1/audit/logs?page=0&limit=25&q=%7BauditCode%3D%22AUD0007A%22%7D'  
  -H 'accept: application/json'  
  -H 'authorization: Bearer '{authorization token here}  
  -H 'content-type: application/json'
```

**Response:**

```
[
    {
        "id": "8af881e59541c90101954d18ecaa0184",
        "correlationId": "a9bdc6c9-b9bf-4c40-8d85-cf6ebedb7972",
        "clusterId": "CEMAN",
        "nodeId": "ceman1",
        "module": "Ceman Audit",
        "auditCode": "AUD0007A",
        "auditOperation": "LOGIN",
        "dataoneUser": "USER1",
        "entityType": "CEMAN",
        "entityId": "ceman1",
        "entityName": "CEMAN",
        "auditMessage": "User ‘USER1’ has logged in",
        "auditTime": "2025-02-28T15:07:13.960+00:00",
        "fromAuditTime": null,
        "toAuditTime": null,
        "dfiid": null
    }
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-mover-1.21/api/audit-logs-apis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
