> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitoring Redis logs with ClickStack

> Monitoring Redis Logs with ClickStack

export const TrackedLink = ({href, eventName, children, ...rest}) => {
  const handleClick = () => {
    try {
      if (typeof window !== "undefined" && window.galaxy && eventName) {
        window.galaxy.track(eventName, {
          interaction: "click"
        });
      }
    } catch (e) {}
  };
  return <a href={href} onClick={handleClick} {...rest}>
      {children}
    </a>;
};

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

<Info>
  **TL;DR**

  Collect and visualize Redis server logs in ClickStack using the OTel `filelog` receiver. Includes a demo dataset and pre-built dashboard.
</Info>

<h2 id="existing-redis">
  Integration with existing Redis
</h2>

This section covers configuring your existing Redis installation to send logs to ClickStack by modifying the ClickStack OTel collector configuration.
If you would like to test the Redis integration before configuring your own existing setup, you can test with our preconfigured setup and sample data in the ["Demo dataset"](/clickstack/integration-examples/redis-logs#demo-dataset) section.

<h3 id="prerequisites">
  Prerequisites
</h3>

* ClickStack instance running
* Existing Redis installation (version 3.0 or newer)
* Access to Redis log files

<Steps>
  <Step>
    <h4 id="verify-redis">
      Verify Redis logging configuration
    </h4>

    First, check your Redis logging configuration. Connect to Redis and check the log file location:

    ```bash theme={null}
    redis-cli CONFIG GET logfile
    ```

    Common Redis log locations:

    * **Linux (apt/yum)**: `/var/log/redis/redis-server.log`
    * **macOS (Homebrew)**: `/usr/local/var/log/redis.log`
    * **Docker**: Often logged to stdout, but can be configured to write to `/data/redis.log`

    If Redis is logging to stdout, configure it to write to a file by updating `redis.conf`:

    ```bash theme={null}
    # Log to file instead of stdout
    logfile /var/log/redis/redis-server.log

    # Set log level (options: debug, verbose, notice, warning)
    loglevel notice
    ```

    After changing the configuration, restart Redis:

    ```bash theme={null}
    # For systemd
    sudo systemctl restart redis

    # For Docker
    docker restart <redis-container>
    ```
  </Step>

  <Step>
    <h4 id="custom-otel">
      Create custom OTel collector configuration
    </h4>

    ClickStack allows you to extend the base OpenTelemetry Collector configuration by mounting a custom configuration file and setting an environment variable. The custom configuration is merged with the base configuration managed by HyperDX via OpAMP.

    Create a file named `redis-monitoring.yaml` with the following configuration:

    ```yaml theme={null}
    receivers:
      filelog/redis:
        include:
          - /var/log/redis/redis-server.log
        start_at: beginning
        operators:
          - type: regex_parser
            regex: '^(?P\d+):(?P\w+) (?P\d{2} \w+ \d{4} \d{2}:\d{2}:\d{2})\.\d+ (?P[.\-*#]) (?P.*)$'
            parse_from: body
            parse_to: attributes
          
          - type: time_parser
            parse_from: attributes.timestamp
            layout: '%d %b %Y %H:%M:%S'
          
          - type: add
            field: attributes.source
            value: "redis"
          
          - type: add
            field: resource["service.name"]
            value: "redis-production"

    service:
      pipelines:
        logs/redis:
          receivers: [filelog/redis]
          processors:
            - memory_limiter
            - transform
            - batch
          exporters:
            - clickhouse
    ```

    This configuration:

    * Reads Redis Logs from their standard location
    * Parses Redis's log format using regex to extract structured fields (`pid`, `role`, `timestamp`, `log_level`, `message`)
    * Adds `source: redis` attribute for filtering in HyperDX
    * Routes logs to the ClickHouse exporter via a dedicated pipeline

    <Note>
      - You only define new receivers and pipelines in the custom config
      - The processors (`memory_limiter`, `transform`, `batch`) and exporters (`clickhouse`) are already defined in the base ClickStack configuration - you just reference them by name
      - The `time_parser` operator extracts timestamps from Redis Logs to preserve original log timing
      - This configuration uses `start_at: beginning` to read all existing logs when the collector starts, allowing you to see logs immediately. For production deployments where you want to avoid re-ingesting logs on collector restarts, change to `start_at: end`.
    </Note>
  </Step>

  <Step>
    <h4 id="load-custom">
      Configure ClickStack to load custom configuration
    </h4>

    To enable custom collector configuration in your existing ClickStack deployment, you must:

    1. Mount the custom config file at `/etc/otelcol-contrib/custom.config.yaml`
    2. Set the environment variable `CUSTOM_OTELCOL_CONFIG_FILE=/etc/otelcol-contrib/custom.config.yaml`
    3. Mount your Redis log directory so the collector can read them

    <h5 id="docker-compose">
      Option 1: Docker Compose
    </h5>

    Update your ClickStack deployment configuration:

    ```yaml theme={null}
    services:
      clickstack:
        # ... existing configuration ...
        environment:
          - CUSTOM_OTELCOL_CONFIG_FILE=/etc/otelcol-contrib/custom.config.yaml
          # ... other environment variables ...
        volumes:
          - ./redis-monitoring.yaml:/etc/otelcol-contrib/custom.config.yaml:ro
          - /var/log/redis:/var/log/redis:ro
          # ... other volumes ...
    ```

    <h5 id="all-in-one">
      Option 2: Docker Run (All-in-One Image)
    </h5>

    If you're using the all-in-one image with docker, run:

    ```bash theme={null}
    docker run --name clickstack \
      -p 8080:8080 -p 4317:4317 -p 4318:4318 \
      -e CUSTOM_OTELCOL_CONFIG_FILE=/etc/otelcol-contrib/custom.config.yaml \
      -v "$(pwd)/redis-monitoring.yaml:/etc/otelcol-contrib/custom.config.yaml:ro" \
      -v /var/log/redis:/var/log/redis:ro \
      clickhouse/clickstack-all-in-one:latest
    ```

    <Note>
      Ensure the ClickStack collector has appropriate permissions to read the Redis log files. In production, use read-only mounts (`:ro`) and follow the principle of least privilege.
    </Note>
  </Step>

  <Step>
    <h4 id="verifying-logs">
      Verifying Logs in HyperDX
    </h4>

    Once configured, log into HyperDX and verify that logs are flowing:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/v1-2Yt8HcdseADex/images/clickstack/redis/redis-log-view.png?fit=max&auto=format&n=v1-2Yt8HcdseADex&q=85&s=7662bc39b77cb7e92412b38cebdc2852" alt="Log view" width="3810" height="1938" data-path="images/clickstack/redis/redis-log-view.png" />

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/v1-2Yt8HcdseADex/images/clickstack/redis/redis-log.png?fit=max&auto=format&n=v1-2Yt8HcdseADex&q=85&s=a4cece690d3fc4c55dc11ad0c940e0b4" alt="Log" width="1919" height="969" data-path="images/clickstack/redis/redis-log.png" />
  </Step>
</Steps>

<h2 id="demo-dataset">
  Demo dataset
</h2>

For users who want to test the Redis integration before configuring their production systems, we provide a sample dataset of pre-generated Redis Logs with realistic patterns.

<Steps>
  <Step>
    <h4 id="download-sample">
      Download the sample dataset
    </h4>

    Download the sample log file:

    ```bash theme={null}
    curl -O https://datasets-documentation.s3.eu-west-3.amazonaws.com/clickstack-integrations/redis/redis-server.log
    ```
  </Step>

  <Step>
    <h4 id="test-config">
      Create test collector configuration
    </h4>

    Create a file named `redis-demo.yaml` with the following configuration:

    ```yaml theme={null}
    cat > redis-demo.yaml << 'EOF'
    receivers:
      filelog/redis:
        include:
          - /tmp/redis-demo/redis-server.log
        start_at: beginning  # Read from beginning for demo data
        operators:
          - type: regex_parser
            regex: '^(?P<pid>\d+):(?P<role>\w+) (?P<timestamp>\d{2} \w+ \d{4} \d{2}:\d{2}:\d{2})\.\d+ (?P<log_level>[.\-*#]) (?P<message>.*)$'
            parse_from: body
            parse_to: attributes
          
          - type: time_parser
            parse_from: attributes.timestamp
            layout: '%d %b %Y %H:%M:%S'
          
          - type: add
            field: attributes.source
            value: "redis-demo"
          
          - type: add
            field: resource["service.name"]
            value: "redis-demo"

    service:
      pipelines:
        logs/redis-demo:
          receivers: [filelog/redis]
          processors:
            - memory_limiter
            - transform
            - batch
          exporters:
            - clickhouse
    EOF
    ```
  </Step>

  <Step>
    <h4 id="run-demo">
      Run ClickStack with demo configuration
    </h4>

    Run ClickStack with the demo logs and configuration:

    ```bash theme={null}
    docker run --name clickstack-demo \
      -p 8080:8080 -p 4317:4317 -p 4318:4318 \
      -e CUSTOM_OTELCOL_CONFIG_FILE=/etc/otelcol-contrib/custom.config.yaml \
      -v "$(pwd)/redis-demo.yaml:/etc/otelcol-contrib/custom.config.yaml:ro" \
      -v "$(pwd)/redis-server.log:/tmp/redis-demo/redis-server.log:ro" \
      clickhouse/clickstack-all-in-one:latest
    ```

    <Note>
      **This mounts the log file directly into the container. This is done for testing purposes with static demo data.**
    </Note>

    <h2 id="verify-demo-logs">
      Verify logs in HyperDX
    </h2>

    Once ClickStack is running:

    1. Open [HyperDX](http://localhost:8080/) and log in to your account (you may need to create an account first)
    2. Navigate to the Search view and set the source to `Logs`
    3. Set the time range to **2025-10-26 10:00:00 - 2025-10-29 10:00:00**

    <Info>
      **Timezone Display**

      HyperDX displays timestamps in your browser's local timezone. The demo data spans **2025-10-27 10:00:00 - 2025-10-28 10:00:00 (UTC)**. The wide time range ensures you'll see the demo logs regardless of your location. Once you see the logs, you can narrow the range to a 24-hour period for clearer visualizations.
    </Info>

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/v1-2Yt8HcdseADex/images/clickstack/redis/redis-log-view.png?fit=max&auto=format&n=v1-2Yt8HcdseADex&q=85&s=7662bc39b77cb7e92412b38cebdc2852" alt="Log view" width="3810" height="1938" data-path="images/clickstack/redis/redis-log-view.png" />

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/v1-2Yt8HcdseADex/images/clickstack/redis/redis-log.png?fit=max&auto=format&n=v1-2Yt8HcdseADex&q=85&s=a4cece690d3fc4c55dc11ad0c940e0b4" alt="Log" width="1919" height="969" data-path="images/clickstack/redis/redis-log.png" />
  </Step>
</Steps>

<h2 id="dashboards">
  Dashboards and visualization
</h2>

To help you get started monitoring Redis with ClickStack, we provide essential visualizations for Redis Logs.

<Steps>
  <Step>
    <h4 id="download">
      <TrackedLink href={'/examples/redis-logs-dashboard.json'} download="redis-logs-dashboard.json" eventName="docs.redis_logs_monitoring.dashboard_download">Download</TrackedLink> the dashboard configuration
    </h4>
  </Step>

  <Step>
    <h4 id="import-dashboard">
      Import Pre-built Dashboard
    </h4>

    1. Open HyperDX and navigate to the Dashboards section.
    2. Click "Import Dashboard" in the upper right corner under the ellipses.

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/2ClO3lhhoY0yBRsd/images/clickstack/import-dashboard.png?fit=max&auto=format&n=2ClO3lhhoY0yBRsd&q=85&s=0cb7577f01de015b8e5e6191c98ca89e" alt="Import Dashboard" width="3024" height="556" data-path="images/clickstack/import-dashboard.png" />

    3. Upload the redis-logs-dashboard.json file and click finish import.

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/v1-2Yt8HcdseADex/images/clickstack/redis/redis-import-dashboard.png?fit=max&auto=format&n=v1-2Yt8HcdseADex&q=85&s=0f13c152f2895e19dbe22c70dcd1b3a6" alt="Finish Import" width="3812" height="1906" data-path="images/clickstack/redis/redis-import-dashboard.png" />
  </Step>

  <Step>
    <h4 id="created-dashboard">
      The dashboard will be created with all visualizations pre-configured
    </h4>

    <Note>
      For the demo dataset, set the time range to **2025-10-27 10:00:00 - 2025-10-28 10:00:00 (UTC)** (adjust based on your local timezone). The imported dashboard won't have a time range specified by default.
    </Note>

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/v1-2Yt8HcdseADex/images/clickstack/redis/redis-logs-dashboard.png?fit=max&auto=format&n=v1-2Yt8HcdseADex&q=85&s=907fb12190554f117cefd2442184db00" alt="Example Dashboard" width="3812" height="1906" data-path="images/clickstack/redis/redis-logs-dashboard.png" />
  </Step>
</Steps>

<h2 id="troubleshooting">
  Troubleshooting
</h2>

<h3 id="troubleshooting-not-loading">
  Custom config not loading
</h3>

**Verify the environment variable is set correctly:**

```bash theme={null}
docker exec <container-name> printenv CUSTOM_OTELCOL_CONFIG_FILE
# Expected output: /etc/otelcol-contrib/custom.config.yaml
```

**Check that the custom config file is mounted:**

```bash theme={null}
docker exec <container-name> ls -lh /etc/otelcol-contrib/custom.config.yaml
# Expected output: Should show file size and permissions
```

**View the custom config content:**

```bash theme={null}
docker exec <container-name> cat /etc/otelcol-contrib/custom.config.yaml
# Should display your redis-monitoring.yaml content
```

**Check the effective config includes your filelog receiver:**

```bash theme={null}
docker exec <container> cat /etc/otel/supervisor-data/effective.yaml | grep -A 10 filelog
# Should show your filelog/redis receiver configuration
```

<h3 id="no-logs">
  No logs appearing in HyperDX
</h3>

**Ensure Redis is writing logs to a file:**

```bash theme={null}
redis-cli CONFIG GET logfile
# Expected output: Should show a file path, not empty string
# Example: 1) "logfile" 2) "/var/log/redis/redis-server.log"
```

**Check Redis is actively logging:**

```bash theme={null}
tail -f /var/log/redis/redis-server.log
# Should show recent log entries in Redis format
```

**Verify the collector can read the logs:**

```bash theme={null}
docker exec <container> cat /var/log/redis/redis-server.log
# Should display Redis log entries
```

**Check for errors in the collector logs:**

```bash theme={null}
docker exec <container> cat /etc/otel/supervisor-data/agent.log
# Look for any error messages related to filelog or Redis
```

**If using docker-compose, verify shared volumes:**

```bash theme={null}
# Check both containers are using the same volume
docker volume inspect <volume-name>
# Verify both containers have the volume mounted
```

<h3 id="logs-not-parsing">
  Logs not parsing correctly
</h3>

**Verify Redis log format matches expected pattern:**

```bash theme={null}
# Redis Logs should look like:
# 12345:M 28 Oct 2024 14:23:45.123 * Server started
tail -5 /var/log/redis/redis-server.log
```

If your Redis Logs have a different format, you may need to adjust the regex pattern in the `regex_parser` operator. The standard format is:

* `pid:role timestamp level message`
* Example: `12345:M 28 Oct 2024 14:23:45.123 * Server started`

<h2 id="next-steps">
  Next steps
</h2>

* Set up [alerts](/clickstack/features/alerts) for critical metrics (error rates, latency thresholds)
* Create additional [dashboards](/clickstack/features/dashboards/overview) for specific use cases (API monitoring, security events)

<h2 id="going-to-production">
  Going to production
</h2>

This guide extends ClickStack's built-in OpenTelemetry Collector for quick setup. For production deployments, we recommend running your own OTel Collector and sending data to ClickStack's OTLP endpoint. See [Sending OpenTelemetry data](/clickstack/ingesting-data/opentelemetry) for production configuration.
