Module
OpenAEV
How-to guide

Turn on the debug mode to find slow requests

Turn on the debug mode of OpenAEV to trace each request with its SQL, find N+1 queries and record the JVM, safely in production, then read the output and turn it off.

OpenAEVFor platform engineers

The debug mode of OpenAEV traces what the platform does, to diagnose a bug or a slow screen on your own installation. It ties the log lines of a request to a trace identifier and logs every SQL statement with its time and its masked values. It flags the requests that repeat the same query, and records the Java virtual machine (JVM) with Java Flight Recorder (JFR). It is off by default and costs nothing then. This page turns it on safely, reads what it writes, and turns it off. Raising the log level only is in Troubleshoot the XTM stack.

Before you start

  • You can change the environment of the openaev service, restart it, and read the files it writes.
  • The output folder is writable and, in a container, on a volume. On a shared platform, restrict access to it: the SQL log mixes the queries of every tenant, with their tenant identifiers in clear.
  • The JFR recording with the default profile settings has a real cost on a busy platform. Plan a window, or use the lighter settings below.

What it produces

PLATFORMDEBUG MODEOUTPUT FOLDERRequesttrace id, tenant, userSQL detailTime and masked valuesORM summaryFlags N+1 queriesJFR recordingCPU and memoryopenaev.debug.output-dirRotated files, size capsConsole logORM summary by default
  1. Request → SQL detail: each statement
  2. Request → ORM summary: one per request
  3. SQL detail → openaev.debug.output-dir: writes
  4. ORM summary → Console log: writes
  5. JFR recording → openaev.debug.output-dir: dumps
The debug mode writes a request trace, the SQL it ran and a JVM recording to a folder you choose
OutputWhereWhat it holds
Trace identifierEvery console log line, as [traceId-spanId]Groups the lines of one request. No tracing backend is needed
SQL detailopenaev-debug-sql.log in the output folder, rotatedEvery SQL statement, with its time, its parameters masked, and the trace, tenant and user of the request
ORM summaryThe console, or openaev-debug-orm.logOne line per request: its number of queries and their time, its user, and an N+1 SUSPECTED warning when the same SELECT repeats
JFR recording.jfr files in the output folderCPU, memory and threads of the JVM, dumped every 10 minutes and at shutdown

A request seen on the console:

WARN  [OpenAEV API] [http-nio-exec-3] [6a3c4dea…0b-7bd42e33…] ...debug.orm   : ORM GET /api/scenarios/sc-42: 13 queries (2 distinct), 7ms user=8f2b-user-helene
  N+1 SUSPECTED: 'select team_name from teams where team_id = ?' executed 12x (6ms total)

The same request in the SQL log:

2026-04-12 23:36:42.179 INFO [trace=6a3c4dea... tenant=0e7c2f1a-tenant-grand-meridian user=8f2b-user-helene] sql success=true time=5ms statement=select team_name from teams where team_id = ? params=[{team_id=team-0}]

Turn it on

  1. Set the debug mode in the environment of the openaev service. A platform runs in production when no dev, test or ci profile is active: there, the mode starts only with the production override too.

    services:
      openaev:
        environment:
          OPENAEV_DEBUG_ENABLED: "true"
          OPENAEV_DEBUG_ALLOW-IN-PRODUCTION: "true"
          OPENAEV_DEBUG_AUTO-DISABLE-AFTER: 30m
          OPENAEV_DEBUG_OUTPUT-DIR: /var/debug
        volumes:
          - debug-data:/var/debug
    volumes:
      debug-data:
    
  2. Recreate the container: docker compose up -d openaev.

    Check that it worked

    The log of the platform shows a banner saying that the debug mode is active, repeated every 5 minutes. Without the production override, it shows an error saying why the mode refused to start, and the platform runs as usual.

  3. Reproduce the problem, and note the time and the page.

OPENAEV_DEBUG_AUTO-DISABLE-AFTER stops the tracing by itself after 30 minutes, so it cannot be left on by mistake; until a restart, the platform keeps a small inactive hook on its database connections.

Read the output

The SQL log is a stream to filter, not a file to read: it holds every statement of the platform, scheduled jobs included, which carry no trace ([trace= tenant=]).

  1. Find the request in the console log, with its time and its path, and copy its trace identifier.

  2. Extract its statements, without folding the long lines:

    grep "trace=6a3c4dea" /var/debug/openaev-debug-sql.log | less -S
    
  3. Look for the slowest time= and for the statements the ORM summary flagged as N+1 SUSPECTED.

  4. Open the .jfr files with JDK Mission Control or jfr print to see where the CPU went.

To keep only the statements of requests, without the scheduled jobs: grep -E "trace=[0-9a-f]" openaev-debug-sql.log. To check the masking: grep MASKED openaev-debug-sql.log.

Turn it off

Remove OPENAEV_DEBUG_ENABLED, or set it to false, and recreate the container. The files stay in the output folder: send them to Filigran support if it asked for them, then delete them.

Keep secrets out of the logs

Masking is on by default, openaev.debug.masking.enabled. A value is replaced by ***MASKED*** when its column or field is named like a secret, such as password, token or client_secret. It is also masked wherever it looks like a JSON Web Token, a Bearer or Basic authorization, a PEM private key or an email address. Both are best effort: a secret in a column with an unusual name and no known shape would still show.

For a guarantee, set openaev.debug.masking.mask-all-parameters (OPENAEV_DEBUG_MASKING_MASK-ALL-PARAMETERS) to true: every value is masked, only the column name and type stay, and the quoted strings of native queries are blanked too. Extend the lists with openaev.debug.masking.sensitive-keys and openaev.debug.masking.value-patterns.

Every setting

All keys start with openaev.debug. and work only while openaev.debug.enabled is true. The openaev.debug block of the configuration reference gives their environment variables.

KeyDefaultWhat it sets
enabledfalseTurns the debug mode on
allow-in-productionfalseLets the mode start in production
auto-disable-after0, neverStops the tracing after this duration, such as 30m
warning-interval5mHow often the log repeats that the mode is active
output-dir./logs/debugThe folder of the files. A read-only container needs a mounted volume here
sql.enabledtrueLogs the SQL statements
sql.slow-query-threshold0ms, allLogs only the statements slower than this, such as 50ms
sql.max-parameter-length200Cuts longer values, after masking
sql.max-file-size500MBSize at which the SQL log rolls over
sql.max-history7Days of SQL logs kept
sql.total-size-cap2GBTotal size of SQL logs kept
orm.summary-to-filefalseWrites the ORM summary to openaev-debug-orm.log instead of the console, to keep it out of a centralized log pipeline
jfr.enabledtrueRecords the JVM. Skipped when the Pyroscope agent is on (pyroscope.agent.enabled)
jfr.settingsprofileprofile, detailed, or default, lighter
jfr.duration10mInterval between two dumps
jfr.max-size100MBSize cap of one recording
jfr.max-age1hAge of the oldest event kept
jfr.max-dump-files12Dumps kept
jfr.max-total-dump-size500MBTotal size of the dumps kept
masking.enabledtrueMasks secrets and personal data
masking.mask-all-parametersfalseMasks every value
masking.mask***MASKED***The replacement text

When the output folder is not writable, the platform keeps running. The JFR recording fails with Debug mode: failed to start JFR recording, and the SQL detail goes to the console with Debug mode: log directory is not writable.

ExampleFind why the scenario list of Grand Meridian is slow

The security engineer of Grand Meridian Hotels reports that the list of scenarios of his tenant takes ten seconds to open since Example CERT imported the Velvet Harbor replays. The platform engineer of Example CERT turns the debug mode on for half an hour, on the production platform, keeping only slow statements and leaving the JVM alone:

services:
  openaev:
    environment:
      OPENAEV_DEBUG_ENABLED: "true"
      OPENAEV_DEBUG_ALLOW-IN-PRODUCTION: "true"
      OPENAEV_DEBUG_AUTO-DISABLE-AFTER: 30m
      OPENAEV_DEBUG_OUTPUT-DIR: /var/debug
      OPENAEV_DEBUG_SQL_SLOW-QUERY-THRESHOLD: 50ms
      OPENAEV_DEBUG_JFR_ENABLED: "false"
    volumes:
      - debug-data:/var/debug
volumes:
  debug-data:

The engineer opens the list again. The console shows N+1 SUSPECTED on the request of the list, with one SELECT on the tags repeated for each scenario. The platform engineer sends the console lines and the statements of that trace to Filigran support, then removes the variables.

What's next

NextHow OpenAEV keeps what you test and what it finds
OpenAEV
Adversarial exposure validation: scenarios, simulations, atomic tests.

Published

Overview
Use
Build dashboards of your validation results
OverviewCreate the widgets of a dashboard
Check one attack technique with an atomic testConnect OpenAEV to OpenCTI to test security coveragesHow collectors measure what your security tools saw
How injectors deliver your injects
OverviewBuilt-in injectors and their injects
Install the OpenAEV agent on your endpointsReview what your injects discovered
Run a simulation and read its results
OverviewShare simulation results in a report
Set up your profile