---
title: Environment variables
description: Describes the environment variables specific to operating the monitoring agent.

---

# Monitoring agent environment variables {: #monitoring-agent-environment-variables }

In addition to the environment variables used to configure the attached [spooler](spooler), you can configure the monitoring agent with the environment variables documented below.

###  General configuration {: #general-configuration }

When you run the agent using the provided `start-agent.sh` script from the `bin/` directory, the following environment configuration options are available:

| Variable |  Description  |
|----------|---------------|
| `MLOPS_AGENT_CONFIG_YAML`| The full path to a custom configuration YAML file. |
| `MLOPS_AGENT_LOG_DIR`    | The directory for writing the agent log file and stdout/error. |
| `JAVA_HOME`              | The Java Virtual Machine (JVM) to run the agent code. If you don't provide a JVM, Java should be included in the system PATH. |

###  Containerized configuration {: #container-configuration }

When you run the agent using the provided `Dockerfile` from the `tools/agent_docker/` directory, the following environment configuration options are available:

| Variable | Description     |
|----------|-----------------|
| `MLOPS_AGENT_CONFIG_YAML`  | The full path to a custom configuration YAML file. |
| `MLOPS_AGENT_LOG_DIR`      | The directory for writing the agent log file and stdout/error. |
| `MLOPS_AGENT_TMP_DIR`      | The directory for writing temporary files (a useful override if the container runs with a read-only root filesystem). |
| `MLOPS_SERVICE_URL`        | Specify the service URL to access MLOps via this environment variable instead of specifying it in the YAML configuration file. |
| `MLOPS_API_TOKEN`          | Provide your API token through this environment variable instead of specifying it in the YAML configuration file. |
| **Advanced configuration** | :~~: |
| `MLOPS_AGENT_JVM_OPT`        | Configure to override the default JVM option `-Xmx1G`.
| `MLOPS_AGENT_LOGGING_CONFIG` | Specify a full path to a completely custom Log4J2 configuration file for the MLOps monitoring agent. |
| `MLOPS_AGENT_LOGGING_FORMAT` | If using our default logging configuration, you can set the logging output format to either `plain` or `json`. |
| `MLOPS_AGENT_LOGGING_LEVEL`  | If using our default logging configuration, set the overall logging level for the agent (e.g. `trace`, `debug`, `info`, `warning`, `error`). |
| `MLOPS_AGENT_LOG_PROPERTIES` | Configure to override the default path to `mlops.log4j2.properties`. |
| `MLOPS_AGENT_SERVER_PORT`    | Set a free port number to activate the embedded HTTP server; this is useful for health and metric monitoring. |
