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

# Debug endpoints

The Chronosphere Collector exposes HTTP endpoints to return information about
the Collector that can help with debugging issues. The Collector enables these
endpoints by default. To disable them, set [`debug.disabled`](#debug-configuration)
to `true` in the Collector manifest.

<Note>
  In Collector version 0.118.0 and later, debug endpoints are bound to loopback
  or localhost by default. For more information about the settings to override
  this default behavior, see [Debug configuration](#debug-configuration).
</Note>

## Access the debug endpoints

All endpoints except `/set_log_level` are clickable links on the `/debug` HTML page,
and are also directly accessible with a `GET` request.

1. In the Collector manifest, enable Prometheus discovery and configure at least one
   scrape configuration:

   <Note>
     You must complete this step to access the debug endpoints, regardless of whether
     you're using the Collector to scrape Prometheus endpoints for metrics.
   </Note>

   ```yaml theme={null}
   prometheus:
        enabled: true
        scrape_configs:
          - job_name: 'access_debug'
            scrape_interval: 30s
            scrape_timeout: 15s
            static_configs:
              - targets: ['192.168.192:9100']
   ```

2. To establish a connection with the Collector, use a method compatible with your
   Collector installation method.

   <Tabs>
     <Tab title="Kubernetes" id="establish-connection-kubernetes">
       For Kubernetes installations, set up port forwarding to access the debug endpoint:

       ```shell theme={null}
       kubectl port-forward chronocollector-POD_NAME LISTEN_PORT
       ```

       Replace the following:

       * *`POD_NAME`*: The name of the Kubernetes pod where your Collector instance is
         running.
       * *`LISTEN_PORT`*: The port where the Collector serves debug requests. The value of
         [`debug.listenAddress`](#debug-configuration) defines this port. If no value
         is set, the default port is `3030`.
     </Tab>

     <Tab title="Standalone" id="establish-connection-standalone">
       For standalone installations, use one of the following methods:

       * (Recommended) Use SSH to directly access your host.

       * Configure the Collector to listen to a specific address by setting a value for
         [`debug.listenAddress`](#debug-configuration).

       * Configure the Collector to set
         [`debug.exposeDebugPagesOnAllInterfaces`](/ingest/metrics-traces/collector/debugging#debug-configuration)
         to `true`. Use with caution, as enabling this setting can publicly expose
         debug endpoints.
     </Tab>
   </Tabs>

3. Open your browser and navigate to `HOSTPORT/debug`. Replace *`HOSTPORT`*
   with the relevant value based on the method and configuration
   settings you used in step 2:

   <Tabs>
     <Tab title="Kubernetes" id="replace-value-kubernetes">
       Replace *`HOSTPORT`* with the value `localhost:3030`.
     </Tab>

     <Tab title="Standalone" id="replace-value-standalone">
       * If you used SSH to directly access your host, replace *`HOSTPORT`*
         with the value `localhost:3030`.

       * If you set a value for `debug.listenAddress`, replace *`HOSTPORT`* with the
         same value you set for `debug.listenAddress`.

       * If you set `debug.exposeDebugPagesOnAllInterfaces` to `true`, replace
         *`HOSTPORT`* with any valid address that your server listens on.
     </Tab>
   </Tabs>

   <Note>
     To make a `GET` request to any debug endpoint, query
     `http://HOSTPORT/debug/<endpoint>`, replacing *`HOSTPORT`* with the relevant
     value.
   </Note>

4. Click one of the [available endpoints](#available-debug-endpoints) from the list.

## Available debug endpoints

* `/debug`

  Displays an HTML page that lists all debug endpoints, each of which is accessible by
  clicking an endpoint from the list. This page also displays a table of active scrape
  targets, which includes two columns:

  * **Target Info:** Lists configuration details for each scrape target.
  * **Last Scrape Result:** For each scrape outcome, lists information about that
    outcome. If available, a decoded body sample shows a portion of the most recent
    scrape output.

* `/debug/bundle`

  Downloads a `tar.gz` file that contains the output of all debug endpoints. The
  file format is `node-name--date--time.tar.gz`, where `node-name` is the name of the
  node the Collector runs in.

* `/debug/collector_runtime_memory_stats`

  Returns runtime memory metrics for the Collector.

* `/debug/config_dump`

  Returns a JSON representation of the Collector configuration settings defined in
  the `raw_config`, combined with the values for those settings calculated at runtime.
  Responses from this endpoint might contain sensitive credentials.

  In Collector version 0.118.0 and later, this endpoint is disabled by default.
  To enable it, set `debug.enableRawConfig` to true.

* `/debug/endpoint_slices`

  Returns a JSON list of all Kubernetes EndpointSlices the Collector detects.

* `/debug/job_configs`

  Returns a JSON list of all computed Kubernetes jobs created from the Collector
  configuration.

* `/debug/pods`

  Returns a JSON list of all Kubernetes pods the Collector detects.

* `/debug/pprof`

  Serves a protocol buffer of the Collector in
  [pprof](https://github.com/google/pprof) format.

* `/debug/raw_config`

  Returns the raw Collector configuration file as-is, without runtime-computed values.
  Responses from this endpoint might contain sensitive credentials.

  In Collector version 0.118.0 and later, this endpoint is disabled by default.
  To enable it, set `debug.enableRawConfig` to true.

* `/debug/service_monitors`

  Returns a JSON list of all dynamic service monitor configurations the Collector
  tracks.

* `/debug/set_log_level`

  Accepts a `PUT` request to temporarily change the logging level of the Collector
  for a specified duration.

  Refer to [temporarily change the Collector log level](/ingest/metrics-traces/collector/configure/optimizations#temporarily-change-the-collector-logging-level)
  for more information.

* `/debug/services`

  Returns a JSON list of all Kubernetes Services the Collector detects.

* `/debug/targets`

  Returns a JSON list of key/value pairs that represent all Kubernetes targets the
  Collector monitors. The first element is the Collector configuration, followed by a
  list of all scrape configurations created from the configuration. The endpoint
  doesn't display Graphite targets.

* `/debug/version`

  Returns a JSON representation of the Collector version information. This is the
  same information the Collector displays at startup.

## Debug configuration

The following Collector configuration settings control the behavior of debug endpoints.

<Warning>
  By default, debug endpoints are served only through loopback or localhost. If
  `debug.exposeDebugPagesOnAllInterfaces` is set to `true`, or if a value is set
  for `debug.listenAddress`, this restriction is no longer enforced.

  When this restriction isn't enforced, remote hosts are able to access
  debug endpoints, which can expose sensitive internal data.
</Warning>

```yaml theme={null}
debug:
  disabled: false
  exposeDebugPagesOnAllInterfaces: false
  listenAddress: ""
  enableRawConfig: false
```

| Setting                                 | Description                                                                                                                                                                                              | Default |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `debug.disabled`                        | If `true`, disables all debug endpoints. Requires Collector version 0.117.0 or later.                                                                                                                    | `false` |
| `debug.exposeDebugPagesOnAllInterfaces` | If `true`, debug endpoints are served on all interfaces that the Collector listens to. Chronosphere recommends against enabling this setting in production environments.                                 | `false` |
| `debug.listenAddress`                   | Overrides the default address and port for debug endpoints. This value is distinct from the [global `listenAddress`](/ingest/metrics-traces/collector/configure/optimizations#define-the-listenaddress). | *none*  |
| `debug.enableRawConfig`                 | If `true`, enables the `/debug/config_dump` and `/debug/raw_config` endpoints.                                                                                                                           | `false` |
