# Troubleshoot the XTM stack

> Find the logs of each part of the XTM stack, raise their level, and fix the common startup, ingestion and Elasticsearch errors.

- URL: https://filigran.io/docs/deploy/operate/troubleshoot/
- Products (the whole suite): XTM One 1.261119.1, OpenCTI 7.261119.0, OpenAEV 3.261118.0, OpenCRQ 0.261123.0, XTM Composer 3.261121.0
- For: platform engineers
- Type: How-to guide

This page helps you find why a part of the XTM stack fails: where its logs are, how to make them more detailed, and what the common errors mean, from a stack that does not start to data that OpenCTI rejects. For problems with integrations that XTM Composer runs, see [Troubleshoot integrations](https://filigran.io/docs/deploy/integrations/troubleshoot/).

**Diagram: Each symptom has its place to look, the health and logs of the services, the works of the connectors or the health of the Elasticsearch cluster, before you ask for help**

- Symptoms: Stack does not start (Or a platform stays unhealthy), Data rejected (Bundles OpenCTI could not write), Elasticsearch errors (Disk full, shards not available)
- Where to look: docker compose ps (Services and their health), docker compose logs (JSON lines of each service), Connector works (Error codes of the bundles), Cluster health (_cluster/health)
- Ask for help: Support package (Logs of every OpenCTI node), Community Slack (Or a GitHub issue)

Connections:

- Stack does not start → docker compose ps: health
- Stack does not start → docker compose logs: why it fails
- Data rejected → Connector works: error code
- Elasticsearch errors → Cluster health: check
- docker compose logs → Support package: still stuck
- Support package → Community Slack: attach

## Find the logs {#find-the-logs}

Every service of xtm-docker writes its logs to the console of its container. From the `xtm-docker` folder:

```bash
docker compose ps
docker compose logs --tail 200 opencti
docker compose logs -f openaev xtm-one
```

`docker compose ps` shows the services that run and their health; `docker compose logs` takes the name of a service, such as `opencti`, `worker`, `openaev`, `xtm-one`, `xtm-one-worker`, `xtm-composer` or `connector-mitre`. The platforms, workers and connectors write JSON lines.

## Raise the log level {#raise-the-log-level}

In production, keep the platforms at `error` or `warn` level. To investigate, raise the level of one service, then lower it again: debug logs are large. Set the variable in `docker-compose.override.yml`, as [Change the stack without editing docker-compose.yml](https://filigran.io/docs/deploy/install/docker-compose/#change-the-stack-without-editing-docker-compose-yml) describes, or in `.env` where the table says so, then run `docker compose up -d <service>`.

**OpenCTI**

| Part | Variable | Values |
| --- | --- | --- |
| Platform | `APP__APP_LOGS__LOGS_LEVEL` | `error`, `warn`, `info`, `debug`. xtm-docker sets `error` |
| Workers | `WORKER_LOG_LEVEL` | `error`, `warning`, `info` (default), `debug` |
| Connectors | `CONNECTOR_LOG_LEVEL` | `error`, `warning`, `info`, `debug` |

`APP__APP_LOGS__LOGS_CONSOLE=true` writes the platform logs to the console, the default. Workers and connectors write JSON while `OPENCTI_JSON_LOGGING` is `true`, the default for workers.

```yaml
services:
  opencti:
    environment:
      - APP__APP_LOGS__LOGS_LEVEL=info
```

**OpenAEV**

OpenAEV takes the logging settings of Spring Boot. To log its own code at debug level:

```yaml
services:
  openaev:
    environment:
      - LOGGING_LEVEL_IO_OPENAEV=debug
```

**XTM One**

`XTM_ONE_LOG_LEVEL` in `.env` sets the level of `xtm-one` and `xtm-one-worker` (default `info`), and `XTM_ONE_LOG_FORMAT` their format (default `json`).

## Control what OpenCTI logs {#control-what-opencti-logs}

Besides the console, the platform writes two log files: `error.log`, errors only, and `opencti.log`, every entry at the configured level. They rotate daily. In a container, they stay inside it and are lost when it is recreated: collect the console output instead, and turn the files off.

| Key | Default | What it does |
| --- | --- | --- |
| `app:app_logs:logs_files` | `true` | Writes the log files |
| `app:app_logs:logs_directory` | `./logs` | Folder of the files, relative to the folder the platform runs from |
| `app:app_logs:logs_max_files` | `7` | Daily files kept for each log |

Each entry carries metadata, such as the data of an error. OpenCTI cuts it to keep log lines small:

| Key | Default | What it does |
| --- | --- | --- |
| `app:app_logs:control:max_string_size` | `5000` | Longest string, in characters. A longer one is cut and ends with `...` |
| `app:app_logs:control:max_array_size` | `50` | Elements kept from a list |
| `app:app_logs:control:max_depth_size` | `10` | Nesting depth. Deeper objects are dropped |
| `app:app_logs:control:max_depth_keys` | `100` | Keys written for one entry. The next ones are dropped |

Two settings help an investigation, and are off by default because of what they write:

- `app:app_logs:extended_error_message` adds the input data to error logs, and the GraphQL query and its variables to the logs of failed API calls. The logs then hold sensitive data.
- `app:performance_logger` logs every API call at `info` level, with its duration, size and memory use. It writes a lot of logs.

For example, to investigate a failing import from the console only:

```yaml
services:
  opencti:
    environment:
      - APP__APP_LOGS__LOGS_LEVEL=info
      - APP__APP_LOGS__LOGS_FILES=false
      - APP__APP_LOGS__EXTENDED_ERROR_MESSAGE=true
```

Set `APP__APP_LOGS__EXTENDED_ERROR_MESSAGE` back to `false` once you have found the cause. The other log keys are in the [Errors](https://filigran.io/docs/reference/opencti/configuration/#errors), [Logging](https://filigran.io/docs/reference/opencti/configuration/#logging) and [Audit](https://filigran.io/docs/reference/opencti/configuration/#audit) sections of the configuration reference.

## The stack does not start {#the-stack-does-not-start}

| Symptom | Cause and fix |
| --- | --- |
| Elasticsearch stops or restarts in a loop | Its logs say why. On Linux, it often needs more virtual memory areas: run `sudo sysctl -w vm.max_map_count=262144` on the host, and add `vm.max_map_count=262144` to `/etc/sysctl.conf` to keep it after a reboot |
| OpenCTI stops at start with `You need to configure the environment vars`, `Email must be a valid email address` or `Token must be a valid UUID` | The bootstrap admin of `.env` is incomplete or invalid. `OPENCTI_ADMIN_EMAIL` must be an email address and `OPENCTI_ADMIN_TOKEN` a UUID, such as the output of `uuidgen`. Neither the password nor the token may be empty or `ChangeMe`. See [Sign in the first time and keep an emergency account](https://filigran.io/docs/deploy/configure/first-access/#the-bootstrap-admins) |
| A platform stays `starting` or `unhealthy` | One of its dependencies is not healthy: check `docker compose ps`, then the logs of the platform and of the dependency. Check that every variable of `.env` has a value |
| OpenAEV stops at start with `FATAL: password authentication failed for user` | The PostgreSQL credentials do not match. PostgreSQL takes `POSTGRES_USER` and `POSTGRES_PASSWORD` only when it creates its data volume, `pgsqlshareddata`: changing them in `.env` afterwards does not change the existing user. Set them back to the values the volume was created with, or change the password inside PostgreSQL with `ALTER USER`. On a manual installation, `spring.datasource.username` and `spring.datasource.password` must be those of the PostgreSQL user |
| `xtm-one-db-init` fails | Its logs say why: `XTM_ONE_POSTGRES_USER` and `XTM_ONE_POSTGRES_PASSWORD` must be set, and `XTM_ONE_POSTGRES_USER` must differ from `POSTGRES_USER` |
| The platforms run but do not see each other | Check the tokens. `PLATFORM_REGISTRATION_TOKEN` must be the same for XTM One, OpenCTI and OpenAEV, also when they run in separate deployments |

## OpenCTI ingestion errors {#opencti-ingestion-errors}

OpenCTI reports the errors of the bundles it could not write in the works of each connector, with an error code.

### Technical errors {#technical-errors}

| Error | Meaning and fix |
| --- | --- |
| `MISSING_REFERENCE_ERROR`, `Element(s) not found` | An object refers to another one that does not exist, such as a relationship whose target is missing. It is raised after several retries, in case the missing object arrives in the meantime. It usually comes from a connector that produces inconsistent STIX 2.1 bundles |
| `Cant upsert inferred entity. Too many entities resolved` | An inference rule produced an entity that matches several existing entities, such as two entities that share a name or an alias, and OpenCTI does not choose which one to update. Data from connectors does not raise it: OpenCTI merges the matching entities. Merge the duplicates in the platform |
| `LOCK_ERROR`, `Execution timeout, too many concurrent call on the same entities` | Several workers changed the same entities at the same time and waited too long for each other. It depends on the throughput of Elasticsearch, the number of workers, the dependencies between the data and the merges. Lower the number of workers, then find the balance between workers, connectors and Elasticsearch sizing. See [Scale](https://filigran.io/docs/deploy/operate/scale/) |

### Data errors {#data-errors}

| Code | Meaning and fix |
| --- | --- |
| `INCORRECT_INDICATOR_FORMAT` | The pattern of an Indicator is not valid, such as a malformed YARA rule. Fix it at the source |
| `INCORRECT_OBSERVABLE_FORMAT` | The value of an observable is not valid for its type, such as an IPv4 address that is not one |
| `INDICATOR_PATTERN_EXCLUDED` | The pattern of an Indicator contains a value of one of your exclusion lists, so the Indicator is rejected on purpose; the rest of the bundle is imported. The error gives the value and the list. If the value should not be excluded, edit the list in **Settings > Customization > Exclusion lists** |

## Elasticsearch errors {#elasticsearch-errors}

| Error | Meaning and fix |
| --- | --- |
| `TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark` | The disk of Elasticsearch is almost full, and Elasticsearch blocks writes to protect itself. Free or add disk space: Elasticsearch lifts the block once usage falls back under its high watermark |
| `Engine execution fail, some shards are not available` | Some shards of an index cannot be read. Check the health of the cluster with `docker compose exec elasticsearch curl -s 'http://localhost:9200/_cluster/health?pretty'` |

To look into the data that OpenCTI stores, connect Kibana or OpenSearch Dashboards to your cluster.

## Ask for help {#ask-for-help}

Generate a [support package](https://filigran.io/docs/deploy/operate/support-package/) of OpenCTI, then ask on the [Filigran community Slack](https://community.filigran.io) or open an issue for [OpenCTI](https://github.com/OpenCTI-Platform/opencti/issues) or [OpenAEV](https://github.com/OpenAEV-Platform/openaev/issues).

## What's next {#what-s-next}

- [Check that the platforms are healthy](https://filigran.io/docs/deploy/operate/health-probes/), to know which dependency is down.
- [Observability metrics](https://filigran.io/docs/deploy/operate/metrics/), to see a problem coming.
- [Collect logs for support](https://filigran.io/docs/deploy/operate/support-package/), to send the logs of every OpenCTI node at once.
- [Errors](https://filigran.io/docs/reference/opencti/errors/): the functional errors OpenCTI returns, by area, and what to do for the most common ones.
