> ## Documentation Index
> Fetch the complete documentation index at: https://docs.knoxcall.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhook Logs

> Monitor webhook deliveries, troubleshoot failures, and correlate webhooks with API requests using the webhook logs.

# Webhook Logs

Every webhook execution is logged, allowing you to monitor deliveries, troubleshoot failures, and correlate webhooks with the original API requests.

## Viewing Webhook Logs

### All Webhook Logs

1. Click **Automation** in the sidebar, then select **Webhooks**
2. Click **Webhook Logs** tab
3. View all webhook executions across all webhooks

### Logs for a Specific Webhook

1. Click **Automation** in the sidebar, then select **Webhooks**
2. Click on a specific webhook
3. Select the **Logs** tab

## Log Entry Details

Each log entry contains:

| Field               | Description                                                    |
| ------------------- | -------------------------------------------------------------- |
| **Webhook Name**    | The webhook that was triggered                                 |
| **Event Type**      | The event that triggered the webhook (e.g., `request.success`) |
| **Executed At**     | Timestamp of the execution                                     |
| **Success**         | Whether the delivery succeeded                                 |
| **Response Status** | HTTP status code from your endpoint                            |
| **Response Time**   | How long the request took (ms)                                 |
| **Retry Count**     | Number of retry attempts                                       |
| **Request ID**      | Links to the original API request                              |

## Log Entry Detail View

Click on a log entry to see full details:

### Request Sent

```json theme={"dark"}
{
  "event": "request.success",
  "timestamp": "2025-01-15T10:30:45.123Z",
  "webhook_id": "wh_abc123",
  "webhook_name": "Slack Notifications",
  "data": {
    "route_id": "route_xyz789",
    "route_name": "payment-api",
    "request": {
      "method": "POST",
      "path": "/v1/charges"
    },
    "response": {
      "status": 200,
      "latency_ms": 342
    }
  }
}
```

### Headers Sent

```json theme={"dark"}
{
  "Content-Type": "application/json",
  "X-Webhook-Signature": "sha256=abc123...",
  "X-Webhook-ID": "wh_abc123",
  "X-Webhook-Event": "request.success",
  "Authorization": "Bearer ***CONFIGURED***"
}
```

### Response Received

```json theme={"dark"}
{
  "ok": true
}
```

### Error Message (if failed)

```text theme={"dark"}
Connection timeout after 30000ms
```

## Filtering Logs

### By Success/Failure

```text theme={"dark"}
Success: ✓ Success Only
         ✗ Failures Only
         All
```

### By Event Type

```text theme={"dark"}
Event Type: request.success
            request.server_error
            request.completed
            (all)
```

### By Webhook

```text theme={"dark"}
Webhook: Slack Notifications
         Analytics Logger
         (all)
```

### By Request ID

Correlate with API logs:

```text theme={"dark"}
Request ID: req_abc123def456
```

## Common Failure Scenarios

### Connection Timeout

**Log shows:**

```text theme={"dark"}
Error: Request timeout
Response Time: 30000ms
Success: false
```

**Causes:**

* Your endpoint is too slow
* Network connectivity issues
* Firewall blocking requests

**Solutions:**

* Increase webhook timeout setting
* Optimize your endpoint response time
* Check firewall rules

### HTTP 4xx Response

**Log shows:**

```text theme={"dark"}
Response Status: 401 Unauthorized
Success: false
```

**Causes:**

* Incorrect authentication configuration
* Token expired
* Endpoint URL changed

**Solutions:**

* Verify auth credentials
* Regenerate tokens if expired
* Check endpoint URL

### HTTP 5xx Response

**Log shows:**

```text theme={"dark"}
Response Status: 500 Internal Server Error
Success: false
Retry Count: 3
```

**Causes:**

* Your endpoint has a bug
* Your endpoint's dependencies are down
* Rate limiting on your endpoint

**Solutions:**

* Check your endpoint logs
* Verify endpoint dependencies
* Implement proper error handling

### Connection Refused

**Log shows:**

```text theme={"dark"}
Error: connect ECONNREFUSED 127.0.0.1:3000
Success: false
```

**Causes:**

* Endpoint server not running
* Incorrect port
* Firewall blocking

**Solutions:**

* Verify endpoint is running
* Check port number
* Review firewall rules

## Correlating with API Logs

Each webhook log includes a `request_id` that links to the original API request:

1. Find the webhook log entry
2. Copy the **Request ID**
3. Navigate to **API Logs**
4. Search by Request ID

This lets you see:

* The original request that triggered the webhook
* Full request/response details
* Client information
* Timing breakdown

## Webhook Statistics

On the webhook detail page, view aggregate statistics:

| Metric             | Description                     |
| ------------------ | ------------------------------- |
| **Trigger Count**  | Total times triggered           |
| **Success Count**  | Successful deliveries           |
| **Failure Count**  | Failed deliveries               |
| **Last Triggered** | Most recent trigger time        |
| **Last Success**   | Most recent successful delivery |
| **Last Failure**   | Most recent failed delivery     |

## Log Retention

Webhook logs are retained based on your plan:

| Plan       | Retention |
| ---------- | --------- |
| Starter    | 7 days    |
| Pro        | 30 days   |
| Enterprise | 90 days   |

## Next Steps

<CardGroup cols={2}>
  <Card title="Testing Webhooks" icon="flask" href="/webhooks/testing-webhooks">
    Test your webhook configuration
  </Card>

  <Card title="API Logs" icon="file-lines" href="/monitoring/api-logs">
    Correlate with API requests
  </Card>

  <Card title="Webhooks Overview" icon="webhook" href="/webhooks/webhooks-overview">
    Learn about webhooks
  </Card>

  <Card title="Creating Webhooks" icon="plus" href="/webhooks/creating-webhooks">
    Create your first webhook
  </Card>
</CardGroup>

***

<CardGroup cols={2}>
  <Card title="Statistics" icon="chart-line">
    * **Level**: beginner
    * **Time**: 5 minutes
  </Card>

  <Card title="Tags" icon="tags">
    `webhooks`, `logs`, `monitoring`, `debugging`, `troubleshooting`
  </Card>
</CardGroup>
