# Get Server Audit Logs

> Retrieve audit log entries for a server.

- ID: `get_server_audit_logs`
- Type: Loop
- Category: [Servers](https://inventor.bot/docs/reference/blocks/servers.md)

> Action Type ID is a numeric identifier for the audit log action. Returns up to 100 entries.

- Loop block: write `for item := range get_server_audit_logs(Args{...}) { ... }` and read the current item's outputs from `item`. See loops.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `server_id` | yes | ID of the server to retrieve audit logs from. |  |
| `limit` |  | Max entries to retrieve (1-100, default 50). |  |
| `user_id` |  | Filter by user who performed the action. |  |
| `action_type` |  | Filter by action type ID. |  |
| `body` |  | Blocks to run for each audit log entry. | blocks: `func() { ... }` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `iteration_number` | Current iteration (1-based). | e.g. `"1"` |
| `total_iterations` | Total number of entries returned. | e.g. `"50"` |
| `entry_id` | ID of the audit log entry. |  |
| `user_id` | ID of the user who performed the action. |  |
| `target_id` | ID of the target entity. |  |
| `action_type_id` | Numeric audit log action type. | e.g. `"20"` |
| `reason` | Reason provided for the action. |  |
| `raw_json` | Full raw JSON of the audit log entry. |  |

**Example**

```go
for serverAuditLog := range get_server_audit_logs(Args{server_id: trigger.server_id}) {
	send_text_message(Args{
		channel_id:      trigger.channel_id,
		message_content: "Entry ID: " + serverAuditLog.entry_id,
	})
}
```