# Activity Streams

Activity Streams provide real-time monitoring of your dedicated IPFS gateway traffic. Using WebSocket connections, you can observe requests to your gateway as they happen, enabling immediate visibility into how your content is being accessed.

## What are Activity Streams?

Activity Streams deliver a live feed of HTTP requests hitting your dedicated gateway. Each request generates an event containing detailed information about the request, allowing you to:

* Monitor content engagement in real-time
* Troubleshoot access issues as they occur
* Validate CDN and caching performance
* Track geographic access patterns
* Debug application integrations

## How It Works

Activity Streams use WebSocket connections to push events to your browser in real-time:

1. **Connect**: Open the Activity Streams view for your gateway
2. **Stream**: Events flow to your browser as requests hit the gateway
3. **Monitor**: View request details in real-time
4. **Analyze**: Use the data to understand traffic patterns

{% hint style="info" %}
Activity Streams show live data only. Events are not persisted or stored for historical analysis. If you need historical logs, consider implementing your own logging solution.
{% endhint %}

## Available Data Fields

Each activity event includes the following information:

| Field             | Description               | Example                     |
| ----------------- | ------------------------- | --------------------------- |
| **Timestamp**     | When the request occurred | `2024-01-15T14:30:45.123Z`  |
| **IP Address**    | Client IP address         | `203.0.113.42`              |
| **HTTP Method**   | Request method            | `GET`                       |
| **Response Code** | HTTP status code          | `200`, `304`, `404`         |
| **Hostname**      | Gateway hostname          | `my-gateway.myfilebase.com` |
| **Path**          | Requested path            | `/ipfs/Qm.../image.png`     |
| **Bytes**         | Response size in bytes    | `1048576`                   |

## Accessing Activity Streams

### Via Web Console

1. Navigate to **Gateways** in the Filebase dashboard.
2. Select the dedicated gateway you want to monitor.
3. Click on the **Activity Streams** tab or button.
4. The stream will connect automatically and begin showing live events.
5. Events appear in real-time as requests hit your gateway.

### Stream Controls

While viewing Activity Streams:

* **Pause/Resume**: Temporarily pause the stream to examine specific events
* **Clear**: Clear the current event list to start fresh
* **Filter**: Filter events by path, status code, or other criteria (if available)

## Use Cases

### Monitor Content Engagement

Track how users interact with your content:

* See which files are most frequently accessed
* Monitor peak traffic periods
* Identify popular content paths

### Troubleshoot Issues

Debug access problems in real-time:

* Identify 404 errors for missing content
* Spot 5xx errors indicating server issues
* Verify CIDs are resolving correctly

### Validate Performance

Ensure your gateway is performing well:

* Check response codes for cache hits (304)
* Monitor response sizes
* Verify CDN is serving content (for Unlimited plan)

### Security Monitoring

Watch for unusual patterns:

* Detect unusual request volumes
* Identify requests from unexpected locations
* Spot potential abuse patterns

## Best Practices

### For Debugging

1. Open Activity Streams before testing
2. Make your test request
3. Find the corresponding event in the stream
4. Check the response code and any error indicators

### For Monitoring

1. Keep a browser tab with Activity Streams open during launches
2. Watch for unexpected error rates
3. Note traffic patterns during announcements or promotions

### For Performance Analysis

1. Monitor response sizes to ensure images are optimized
2. Check for 304 responses indicating effective caching
3. Track response codes to identify content issues

## Limitations

* **Real-time only**: Events are not stored; close the stream and they're gone
* **Browser-based**: Requires an active browser session to view
* **Single gateway**: Each stream monitors one gateway at a time
* **No aggregation**: Raw events without built-in analytics

{% hint style="warning" %}
For production monitoring needs, consider implementing application-level logging or using third-party analytics tools in addition to Activity Streams.
{% endhint %}

## Related Features

Activity Streams complement other gateway features:

* **Access Controls**: Monitor who is accessing restricted content
* **Image Optimizations**: Verify optimized images are being served
* **Custom Domains**: See traffic across all domains pointing to your gateway
