# Monitoring the agent

The agent can be monitored using two approaches: using technical logs (to get insights about the internal behavior of the agent), and using Prometheus metrics, to collect metrics about the performance and the traffic of the agent.

## Technical logs [Permalink to this section](/content/documentation/agent-documentation/monitoring-the-agent#technical-logs "Permalink to this section"/index.html)

The agent can be configured to log technical information about its internal behavior, which can be useful for debugging purposes or for monitoring the health of the agent. The technical logs are different from the access logs, as they are not focused on the incoming requests, but rather on the internal operations of the agent such as the handling of the rules, the communication with the backend servers, the management of the SSL certificates, the collection of logs, etc.

The `log` configuration key allows you to specify the type of the output (as a file, on the standard output or to a syslog server), the format of the logs (`json`, `text`, `rfc3164` or `rfc5424`) and the path to the log file.

For example:

```yaml
instance:
    name: 'My Instance'
reverse_proxy:
    listen:
        - 'tcp://0.0.0.0:80'
    forward:
        address: 'backend:8080'
    agent:
        project_key: my-project-key
log:
    -
        output: file
        format: json
        path: /var/log/redirection.log.json
    -
        output: stdout
        format: text
    -
        output: stderr
        format: json
    -
        output: syslog
        format: rfc5424
        address: 'syslog-server:514'
```

## Prometheus metrics [Permalink to this section](/content/documentation/agent-documentation/monitoring-the-agent#prometheus-metrics "Permalink to this section"/index.html)

The redirection.io agent can expose a set of Prometheus metrics that can be used to monitor the performance and the traffic of the agent.

By default, the metrics endpoint is disabled, but you can enable it by configuring the `metrics.listen` configuration key in the agent configuration file.

For example:

```yaml
instance:
    name: 'My Instance'
reverse_proxy:
    listen:
        - 'tcp://0.0.0.0:80'
    forward:
        address: 'backend:8080'
    agent:
        project_key: my-project-key
metrics:
    listen: '127.0.0.1:9000'
```

The Prometheus metrics include:

- global agent metrics:
  - `process_cpu_seconds_total`: Total user and system CPU time spent, in seconds.
  - `process_max_fds`: Maximum number of open file descriptors allowed for the agent process.
  - `process_open_fds`: Number of open file descriptors.
  - `process_resident_memory_bytes`: Resident memory size, in bytes.
  - `process_start_time_seconds`: Start time of the process since unix epoch in seconds.
  - `process_threads`: Number of OS threads in the process.
  - `process_virtual_memory_bytes`: Virtual memory size in bytes.
- per-project metrics:
  - `redirectionio_matching_requests`: Number of times a matching request was executed by the router
  - `redirectionio_rules_count`: Number of rules inside the router
  - `redirectionio_rules_count_live`: Number of rules inside the router (in live mode)
  - `redirectionio_rules_update_histogram`: Histogram of the duration of the rules update process, in milliseconds
  - `redirectionio_logs_buffer_size`: Memory size of the logs buffer, in bytes
- per-hostname metrics:
  - `redirectionio_request_bytes`: Number of bytes received in the requests
  - `redirectionio_response_bytes`: Number of bytes sent in the responses
  - `redirectionio_request_count`: Number of requests received by the agent

This page has been updated on Mar 30, 2026.
