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

# Local logs & metrics

> Getting started with ClickStack local and system data and metrics

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

This getting started guide allows you to collect local logs and metrics from your system, sending them to ClickStack for visualization and analysis.

**This example works on OSX and Linux systems only**

<Tabs>
  <Tab title="Managed ClickStack">
    This guide assumes you have completed the [Getting Started Guide for Managed ClickStack](/clickstack/deployment/managed) and have the [connection credentials recorded](/clickstack/getting-started/managed#next-steps).

    <Steps>
      <Step>
        <h3 id="create-otel-configuration">
          Create a custom OpenTelemetry configuration
        </h3>

        Create a `custom-local-config.yaml` file with the following content:

        ```yaml theme={null}
        receivers:
          filelog:
            include:
              - /host/var/log/**/*.log        # Linux logs from host
              - /host/var/log/syslog
              - /host/var/log/messages
              - /host/private/var/log/*.log   # macOS logs from host
            start_at: beginning
            resource:
              service.name: "system-logs"

          hostmetrics:
            collection_interval: 1s
            scrapers:
              cpu:
                metrics:
                  system.cpu.time:
                    enabled: true
                  system.cpu.utilization:
                    enabled: true
              memory:
                metrics:
                  system.memory.usage:
                    enabled: true
                  system.memory.utilization:
                    enabled: true
              filesystem:
                metrics:
                  system.filesystem.usage:
                    enabled: true
                  system.filesystem.utilization:
                    enabled: true
              paging:
                metrics:
                  system.paging.usage:
                    enabled: true
                  system.paging.utilization:
                    enabled: true
                  system.paging.faults:
                    enabled: true
              disk:
              load:
              network:
              processes:

        service:
          pipelines:
            logs/local:
              receivers: [filelog]
              processors:
                - memory_limiter
                - batch
              exporters:
                - clickhouse
            metrics/hostmetrics:
              receivers: [hostmetrics]
              processors:
                - memory_limiter
                - batch
              exporters:
                - clickhouse
        ```

        This configuration collects system logs and metrics for OSX and Linux systems, sending the results to ClickStack. The configuration extends the ClickStack collector by adding new receivers and pipelines—you reference the existing `clickhouse` exporter and processors (`memory_limiter`, `batch`) that are already configured in the base ClickStack collector.

        <Info>
          **Ingestion timestamps**

          This configuration adjusts timestamps at ingest, assigning an updated time value to each event. You should ideally [preprocess or parse timestamps](/clickstack/ingesting-data/collector#processing-filtering-transforming-enriching) using OTel processors or operators in their log files to ensure accurate event time is retained.

          With this example setup, if the receiver or file processor is configured to start at the beginning of the file, all existing log entries will be assigned the same adjusted timestamp - the time of processing rather than the original event time. Any new events appended to the file will receive timestamps approximating their actual generation time.

          To avoid this behavior, you can set the start position to `end` in the receiver configuration. This ensures only new entries are ingested and timestamped near their true arrival time.
        </Info>

        For more details on the OpenTelemetry (OTel) configuration structure, we recommend [the official guide](https://opentelemetry.io/docs/collector/configuration/).
      </Step>

      <Step>
        <h3 id="start-the-otel-collector">
          Start the OpenTelemetry collector
        </h3>

        Run a standalone collector with the following command:

        ```shell theme={null}
        docker run -d \
          -p 4317:4317 -p 4318:4318 \
          --user 0:0 \
          -e CUSTOM_OTELCOL_CONFIG_FILE=/etc/otelcol-contrib/custom.config.yaml \
          -e CLICKHOUSE_ENDPOINT=${CLICKHOUSE_ENDPOINT} \
          -e CLICKHOUSE_USER=${CLICKHOUSE_USER} \
          -e CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD} \
          -v "$(pwd)/custom-local-config.yaml:/etc/otelcol-contrib/custom.config.yaml:ro" \
          -v /var/log:/host/var/log:ro \
          -v /private/var/log:/host/private/var/log:ro \
          clickhouse/clickstack-otel-collector:latest
        ```

        The collector will immediately begin collecting local system logs and metrics.
      </Step>

      <Step>
        <h3 id="select-your-service">
          Select your service
        </h3>

        Select the service with Managed ClickStack from the main ClickHouse cloud landing page.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/v1-2Yt8HcdseADex/images/clickstack/select_service.png?fit=max&auto=format&n=v1-2Yt8HcdseADex&q=85&s=e555abb187c8e9b22642959525b43d3a" alt="Select Service" size="lg" width="3600" height="2040" data-path="images/clickstack/select_service.png" />
      </Step>

      <Step>
        <h3 id="navigate-to-the-hyperdx-ui">
          Explore system logs
        </h3>

        Select `ClickStack` from the left menu to navigate to the ClickStack UI, where you will be automatically authenticated.

        The search UI should be populated with local system logs. Expand the filters to select the `system.log`:

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-20.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=ddfa301c1b3b5428d80b8b3211703170" alt="HyperDX Local logs" size="lg" width="4800" height="2700" data-path="images/use-cases/observability/hyperdx-20.png" />
      </Step>

      <Step>
        <h3 id="explore-system-metrics">
          Explore system metrics
        </h3>

        We can explore our metrics using charts.

        Navigate to the Chart Explorer via the left menu. Select the source `Metrics` and `Maximum` as the aggregation type.

        For the `Select a Metric` menu simply type `memory` before selecting `system.memory.utilization (Gauge)`.

        Press the run button to visualize your memory utilization over time.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-21.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=4f326a1ebeb2eb09a30c182b4fd1da6c" alt="Memory over time" size="lg" width="4800" height="2700" data-path="images/use-cases/observability/hyperdx-21.png" />

        Note the number is returned as a floating point `%`. To render it more clearly, select `Set number format`.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-22.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=0b643b856188d0c245310328f6ffd208" alt="Number format" size="lg" width="4800" height="2700" data-path="images/use-cases/observability/hyperdx-22.png" />

        From the subsequent menu you can select `Percentage` from the `Output format` drop down before clicking `Apply`.

        <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-23.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=38dec366080aec8f9d44da56ea58673f" alt="Memory % of time" size="lg" width="4800" height="2700" data-path="images/use-cases/observability/hyperdx-23.png" />
      </Step>
    </Steps>
  </Tab>

  <Tab title="ClickStack Open Source">
    <h3 id="create-otel-configuration-oss">
      Create a custom OpenTelemetry configuration
    </h3>

    Create a `custom-local-config.yaml` file with the following content:

    ```yaml theme={null}
    receivers:
      filelog:
        include:
          - /host/var/log/**/*.log        # Linux logs from host
          - /host/var/log/syslog
          - /host/var/log/messages
          - /host/private/var/log/*.log   # macOS logs from host
        start_at: beginning
        resource:
          service.name: "system-logs"

      hostmetrics:
        collection_interval: 1s
        scrapers:
          cpu:
            metrics:
              system.cpu.time:
                enabled: true
              system.cpu.utilization:
                enabled: true
          memory:
            metrics:
              system.memory.usage:
                enabled: true
              system.memory.utilization:
                enabled: true
          filesystem:
            metrics:
              system.filesystem.usage:
                enabled: true
              system.filesystem.utilization:
                enabled: true
          paging:
            metrics:
              system.paging.usage:
                enabled: true
              system.paging.utilization:
                enabled: true
              system.paging.faults:
                enabled: true
          disk:
          load:
          network:
          processes:

    service:
      pipelines:
        logs/local:
          receivers: [filelog]
          processors:
            - memory_limiter
            - batch
          exporters:
            - clickhouse
        metrics/hostmetrics:
          receivers: [hostmetrics]
          processors:
            - memory_limiter
            - batch
          exporters:
            - clickhouse
    ```

    This configuration collects system logs and metrics for OSX and Linux systems, sending the results to ClickStack. The configuration extends the ClickStack collector by adding new receivers and pipelines—you reference the existing `clickhouse` exporter and processors (`memory_limiter`, `batch`) that are already configured in the base ClickStack collector.

    <Info>
      **Ingestion timestamps**

      This configuration adjusts timestamps at ingest, assigning an updated time value to each event. You should ideally [preprocess or parse timestamps](/clickstack/ingesting-data/collector#processing-filtering-transforming-enriching) using OTel processors or operators in their log files to ensure accurate event time is retained.

      With this example setup, if the receiver or file processor is configured to start at the beginning of the file, all existing log entries will be assigned the same adjusted timestamp - the time of processing rather than the original event time. Any new events appended to the file will receive timestamps approximating their actual generation time.

      To avoid this behavior, you can set the start position to `end` in the receiver configuration. This ensures only new entries are ingested and timestamped near their true arrival time.
    </Info>

    For more details on the OpenTelemetry (OTel) configuration structure, we recommend [the official guide](https://opentelemetry.io/docs/collector/configuration/).

    <h3 id="start-clickstack">
      Start ClickStack with custom configuration
    </h3>

    Run the following docker command to start the all-in-one container with your custom configuration:

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

    <Info>
      **Root user**

      We run the collector as the root user to access all system logs—this is necessary to capture logs from protected paths on Linux-based systems. However, this approach isn't recommended for production. In production environments, the OpenTelemetry Collector should be deployed as a local agent with only the minimal permissions required to access the intended log sources.

      Note that we mount the host's `/var/log` to `/host/var/log` inside the container to avoid conflicts with the container's own log files.
    </Info>

    <h3 id="navigate-to-the-hyperdx-ui-oss">
      Explore system logs
    </h3>

    Visit [http://localhost:8080](http://localhost:8080) to access the ClickStack UI if deploying locally.

    Data sources should be pre-created for you. The search UI should be populated with local system logs. Expand the filters to select the `system.log`:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-20.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=ddfa301c1b3b5428d80b8b3211703170" alt="HyperDX Local logs" size="lg" width="4800" height="2700" data-path="images/use-cases/observability/hyperdx-20.png" />

    <h3 id="explore-system-metrics-oss">
      Explore system metrics
    </h3>

    We can explore our metrics using charts.

    Navigate to the Chart Explorer via the left menu. Select the source `Metrics` and `Maximum` as the aggregation type.

    For the `Select a Metric` menu simply type `memory` before selecting `system.memory.utilization (Gauge)`.

    Press the run button to visualize your memory utilization over time.

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-21.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=4f326a1ebeb2eb09a30c182b4fd1da6c" alt="Memory over time" size="lg" width="4800" height="2700" data-path="images/use-cases/observability/hyperdx-21.png" />

    Note the number is returned as a floating point `%`. To render it more clearly, select `Set number format`.

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-22.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=0b643b856188d0c245310328f6ffd208" alt="Number format" size="lg" width="4800" height="2700" data-path="images/use-cases/observability/hyperdx-22.png" />

    From the subsequent menu you can select `Percentage` from the `Output format` drop down before clicking `Apply`.

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/s7SvMaubt_rFZWes/images/use-cases/observability/hyperdx-23.png?fit=max&auto=format&n=s7SvMaubt_rFZWes&q=85&s=38dec366080aec8f9d44da56ea58673f" alt="Memory % of time" size="lg" width="4800" height="2700" data-path="images/use-cases/observability/hyperdx-23.png" />
  </Tab>
</Tabs>
