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

# Monitoring host logs with ClickStack

> Monitoring Generic Host 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 host system logs (syslog, auth, kernel) in ClickStack using the OTel `filelog` receiver. Includes a demo dataset and pre-built dashboard.
</Info>

<h2 id="existing-hosts">
  Integration with existing hosts
</h2>

This section covers configuring your existing hosts to send system logs to ClickStack by modifying the ClickStack OTel collector configuration to read all system log files (syslog, auth, kernel, daemon, and application logs).

If you would like to test the host logs integration before configuring your own existing setup, you can test with our preconfigured setup and sample data in the ["Demo dataset"](/clickstack/integration-examples/host-logs#demo-dataset) section.

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

* ClickStack instance running
* System with syslog files
* Access to modify ClickStack configuration files

<Steps>
  <Step>
    <h4 id="verify-syslog">
      Verify syslog files exist
    </h4>

    First, verify that your system is writing syslog files:

    ```bash theme={null}
    # Check if syslog files exist (Linux)
    ls -la /var/log/syslog /var/log/messages

    # Or on macOS
    ls -la /var/log/system.log

    # View recent entries
    tail -20 /var/log/syslog
    ```

    Common syslog locations:

    * **Ubuntu/Debian**: `/var/log/syslog`
    * **RHEL/CentOS/Fedora**: `/var/log/messages`
    * **macOS**: `/var/log/system.log`
  </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.

    Create a file named `host-logs-monitoring.yaml` with the configuration for your system:

    <Tabs>
      <Tab title="Modern Linux (Ubuntu 24.04+)">
        ```yaml theme={null}
        receivers:
          filelog/syslog:
            include:
              - /var/log/syslog
              - /var/log/**/*.log
            start_at: end
            operators:
              - type: regex_parser
                regex: '^(?P<timestamp>\S+) (?P<hostname>\S+) (?P<unit>\S+?)(?:\[(?P<pid>\d+)\])?: (?P<message>.*)$'
                parse_from: body
                parse_to: attributes
              
              - type: time_parser
                parse_from: attributes.timestamp
                layout_type: gotime
                layout: '2006-01-02T15:04:05.999999-07:00'
              
              - type: add
                field: attributes.source
                value: "host-logs"
              
              - type: add
                field: resource["service.name"]
                value: "host-production"

        service:
          pipelines:
            logs/host:
              receivers: [filelog/syslog]
              processors:
                - memory_limiter
                - transform
                - batch
              exporters:
                - clickhouse
        ```
      </Tab>

      <Tab title="Legacy Linux (Ubuntu 20.04, RHEL, CentOS)">
        ```yaml theme={null}
        receivers:
          filelog/syslog:
            include:
              - /var/log/syslog
              - /var/log/messages
              - /var/log/**/*.log
            start_at: end
            operators:
              - type: regex_parser
                regex: '^(?P<timestamp>\w+ \d+ \d{2}:\d{2}:\d{2}) (?P<hostname>\S+) (?P<unit>\S+?)(?:\[(?P<pid>\d+)\])?: (?P<message>.*)$'
                parse_from: body
                parse_to: attributes
              
              - type: time_parser
                parse_from: attributes.timestamp
                layout: '%b %d %H:%M:%S'
              
              - type: add
                field: attributes.source
                value: "host-logs"
              
              - type: add
                field: resource["service.name"]
                value: "host-production"

        service:
          pipelines:
            logs/host:
              receivers: [filelog/syslog]
              processors:
                - memory_limiter
                - transform
                - batch
              exporters:
                - clickhouse
        ```
      </Tab>

      <Tab title="macOS">
        ```yaml theme={null}
        receivers:
          filelog/syslog:
            include:
              - /var/log/system.log
              - /host/private/var/log/*.log
            start_at: end
            operators:
              - type: regex_parser
                regex: '^(?P<timestamp>\w+ \d+ \d{2}:\d{2}:\d{2}) (?P<hostname>\S+) (?P<unit>\S+?)(?:\[(?P<pid>\d+)\])?: (?P<message>.*)$'
                parse_from: body
                parse_to: attributes
              
              - type: time_parser
                parse_from: attributes.timestamp
                layout: '%b %d %H:%M:%S'
              
              - type: add
                field: attributes.source
                value: "host-logs"
              
              - type: add
                field: resource["service.name"]
                value: "host-production"

        service:
          pipelines:
            logs/host:
              receivers: [filelog/syslog]
              processors:
                - memory_limiter
                - transform
                - batch
              exporters:
                - clickhouse
        ```
      </Tab>
    </Tabs>

    <br />

    All configurations:

    * Read syslog files from their standard locations
    * Parse the syslog format to extract structured fields (timestamp, hostname, unit/service, PID, message)
    * Preserve original log timestamps
    * Add `source: host-logs` attribute for filtering in HyperDX
    * Route 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 regex parser extracts systemd unit names, PIDs, and other metadata from the syslog format
      - This configuration uses `start_at: end` to avoid re-ingesting logs on collector restarts. For testing, change to `start_at: beginning` to see historical logs immediately.
    </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 syslog 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:
          - ./host-logs-monitoring.yaml:/etc/otelcol-contrib/custom.config.yaml:ro
          - /var/log:/var/log: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)/host-logs-monitoring.yaml:/etc/otelcol-contrib/custom.config.yaml:ro" \
      -v /var/log:/var/log:ro \
      clickhouse/clickstack-all-in-one:latest
    ```

    <Note>
      Ensure the ClickStack collector has appropriate permissions to read the syslog 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 logs are flowing:

    1. Navigate to the search view
    2. Set source to Logs
    3. Filter by `source:host-logs` to see host-specific logs
    4. You should see structured log entries with fields like `unit`, `hostname`, `pid`, `message`, etc.

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/mGB-7MnBG_6npuhw/images/clickstack/host-logs/search-view.png?fit=max&auto=format&n=mGB-7MnBG_6npuhw&q=85&s=ee448aacaeeacec91a87fd29ff30a862" alt="Search view" width="3812" height="1936" data-path="images/clickstack/host-logs/search-view.png" />

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/mGB-7MnBG_6npuhw/images/clickstack/host-logs/log-view.png?fit=max&auto=format&n=mGB-7MnBG_6npuhw&q=85&s=6533642101355932a36d2be3b31ba146" alt="Log view" width="3812" height="1936" data-path="images/clickstack/host-logs/log-view.png" />
  </Step>
</Steps>

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

For users who want to test the host logs integration before configuring their production systems, we provide a sample dataset of pre-generated system 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/host-logs/journal.log
    ```

    The dataset includes:

    * System boot sequence
    * SSH login activity (successful and failed attempts)
    * Security incident (brute force attack with fail2ban response)
    * Scheduled maintenance (cron jobs, anacron)
    * Service restarts (rsyslog)
    * Kernel messages and firewall activity
    * Mix of normal operations and notable events
  </Step>

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

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

    ```yaml theme={null}
    cat > host-logs-demo.yaml << 'EOF'
    receivers:
      filelog/journal:
        include:
          - /tmp/host-demo/journal.log
        start_at: beginning
        operators:
          - type: regex_parser
            regex: '^(?P<timestamp>\S+) (?P<hostname>\S+) (?P<unit>\S+?)(?:\[(?P<pid>\d+)\])?: (?P<message>.*)$'
            parse_from: body
            parse_to: attributes
          
          - type: time_parser
            parse_from: attributes.timestamp
            layout: '%Y-%m-%dT%H:%M:%S%z'
          
          - type: add
            field: attributes.source
            value: "host-demo"
          
          - type: add
            field: resource["service.name"]
            value: "host-demo"

    service:
      pipelines:
        logs/host-demo:
          receivers: [filelog/journal]
          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)/host-logs-demo.yaml:/etc/otelcol-contrib/custom.config.yaml:ro" \
      -v "$(pwd)/journal.log:/tmp/host-demo/journal.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>
  </Step>

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

    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-11-10 00:00:00 - 2025-11-13 00:00:00**

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/mGB-7MnBG_6npuhw/images/clickstack/host-logs/search-view.png?fit=max&auto=format&n=mGB-7MnBG_6npuhw&q=85&s=ee448aacaeeacec91a87fd29ff30a862" alt="Search view" width="3812" height="1936" data-path="images/clickstack/host-logs/search-view.png" />

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/mGB-7MnBG_6npuhw/images/clickstack/host-logs/log-view.png?fit=max&auto=format&n=mGB-7MnBG_6npuhw&q=85&s=6533642101355932a36d2be3b31ba146" alt="Log view" width="3812" height="1936" data-path="images/clickstack/host-logs/log-view.png" />

    <Info>
      **Timezone Display**

      HyperDX displays timestamps in your browser's local timezone. The demo data spans **2025-11-11 00:00:00 - 2025-11-12 00: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>
  </Step>
</Steps>

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

To help you get started monitoring host logs with ClickStack, we provide essential visualizations for system logs.

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

  <Step>
    <h4 id="import-dashboard">
      Import the 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-8c05c8a2/mGB-7MnBG_6npuhw/images/clickstack/import-dashboard.png?fit=max&auto=format&n=mGB-7MnBG_6npuhw&q=85&s=21af53f2ddc48534745ebc3f01de39ef" alt="Import dashboard button" width="3024" height="556" data-path="images/clickstack/import-dashboard.png" />

    3. Upload the `host-logs-dashboard.json` file and click **Finish Import**

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/mGB-7MnBG_6npuhw/images/clickstack/host-logs/import-dashboard.png?fit=max&auto=format&n=mGB-7MnBG_6npuhw&q=85&s=482fb27798657430bacf5d430f57c42c" alt="Finish import" width="3808" height="1908" data-path="images/clickstack/host-logs/import-dashboard.png" />
  </Step>

  <Step>
    <h4 id="created-dashboard">
      View the dashboard
    </h4>

    The dashboard will be created with all visualizations pre-configured:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/mGB-7MnBG_6npuhw/images/clickstack/host-logs/host-logs-dashboard.png?fit=max&auto=format&n=mGB-7MnBG_6npuhw&q=85&s=642872ea209d02a6da070f003a4ce9c4" alt="Logs dashboard" width="3808" height="1908" data-path="images/clickstack/host-logs/host-logs-dashboard.png" />

    Key visualizations include:

    * Log volume over time by severity
    * Top systemd units generating logs
    * SSH login activity (successful vs failed)
    * Firewall activity (blocked vs allowed)
    * Security events (failed logins, bans, blocks)
    * Service restart activity

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

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

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

Verify the environment variable is set:

```bash theme={null}
docker exec <container-name> printenv CUSTOM_OTELCOL_CONFIG_FILE
```

Check the custom config file is mounted and readable:

```bash theme={null}
docker exec <container-name> cat /etc/otelcol-contrib/custom.config.yaml | head -10
```

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

**Verify syslog files exist and are being written:**

```bash theme={null}
# Check if syslog exists
ls -la /var/log/syslog /var/log/messages

# Verify logs are being written
tail -f /var/log/syslog
```

**Check the collector can read the logs:**

```bash theme={null}
docker exec <container> cat /var/log/syslog | head -20
```

**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
```

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

```bash theme={null}
docker exec <container> cat /etc/otel/supervisor-data/agent.log | grep -i "filelog\|syslog"
```

**If using the demo dataset, verify the log file is accessible:**

```bash theme={null}
docker exec <container> cat /tmp/host-demo/journal.log | wc -l
```

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

**Verify your syslog format matches the configuration you chose:**

For Modern Linux (Ubuntu 24.04+):

```bash theme={null}
# Should show ISO8601 format: 2025-11-17T20:55:44.826796+00:00
tail -5 /var/log/syslog
```

For Legacy Linux or macOS:

```bash theme={null}
# Should show traditional format: Nov 17 14:16:16
tail -5 /var/log/syslog
# or
tail -5 /var/log/system.log
```

If your format doesn't match, select the appropriate configuration tab in the [Create custom OTel collector configuration](#custom-otel) section.

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

* Set up [alerts](/clickstack/features/alerts) for critical system events (service failures, authentication failures, disk warnings)
* Filter by specific units to monitor particular services
* Correlate host logs with application logs for comprehensive troubleshooting
* Create custom dashboards for security monitoring (SSH attempts, sudo usage, firewall blocks)

<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.
