---
title: "Trading Session Gateway configuration reference"
description: "Complete YAML reference for Trading Session Gateway: licensing, channels, Geneos instrumentation, Status UI, search, schedules, and worked examples."
url: "https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway-config-ref/index.html"
---
## Overview

This page is the complete reference for `tr-gateway.yaml`. For installation, Geneos setup, published dataviews, and Search Messages, see [Trading Session Gateway](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html). For end-to-end samples, see [Worked examples](#worked-examples). For a full production-oriented file, see [Complete configuration](#complete-configuration).

### Naming and conventions

- YAML keys — use kebab-case for every key, including `licensing`. The loader converts a hyphenated key to camelCase for every configuration class. For example, `listen-port`, `demo-mode`, `tls-config`, and `trust-chain-file`. The camelCase names in the shipped files also work, such as `demoMode`, `tlsConfig`, and `trustChainFile`.
- Unknown keys are fatal — the configuration loader rejects any key it does not recognize, including misspelled keys and keys that were removed in an earlier release. TR Gateway fails at startup with an `Unable to find property` error instead of ignoring the key.
- Units — duration fields end in `-ms` or `-seconds`. Size and capacity units are noted in each table (bytes, records, days).
- Environment substitution — values of the form `${env:VAR}` or `${env:VAR:default}` are replaced from the process environment at load time. See [Credential handling](#credential-handling).
- Load once — configuration is read once at startup. Restart TR Gateway to apply changes.
- Protocol family — channel `protocol` hints and `protocol-dialects` keys use the families `fix`, `ouch`, `sqf`, and `drop`. FIX needs no dialect entry. Non-FIX families need a dialect that matches the wire format from the file streamer. See [Protocol dialects](#protocol-dialects).
- Search activation — message search is active when `search.data-dir` is set. Omit `search` (or omit `data-dir`) to leave search inactive.
- Licensing TLS — `licensing.tls-config` uses the same kebab-case names as Geneos probe TLS and channel TLS: `cert-file`, `key-file`, `trust-chain-file`, and `min-tls-version`. The camelCase names in the shipped files also work.

## Silent-correctness settings


**Important**


These settings change which data you get without producing an error when they are wrong or missing. TR Gateway still starts and still ingests. It stores or labels data differently, with no warning.



| Setting | Wrong or missing case | Result |
| --- | --- | --- |
| [Protocol dialects](#protocol-dialects) | A non-FIX family you actually stream has no entry | Licensed records use the built-in raw family parser. That parser decodes one fixed venue layout, so a feed from another venue is misparsed. Rows stay in the native search tables, with no FIX normalization and no per-protocol dialect dataviews |
| [Local CompID prefixes](#local-compid-prefixes) | Empty list on a FIX channel | Direction falls back to message-type inference, which can mislabel inbound or outbound traffic |
| [Operational schedules](#operational-schedule-fields) | `holiday-calendar` names a calendar that is not in `holiday-calendars` | The name is ignored. The window has no holidays, and TR Gateway reports no error |

Set a protocol dialect and the local CompID prefixes for every production FIX and native-protocol feed. Define each holiday calendar before a schedule names it.

## Credential handling


**Important**


Do not store passwords, certificate private-key passphrases, or other secrets as plaintext in `tr-gateway.yaml`. Use environment-variable substitution.



At load time, values of the form `${env:VAR}` or `${env:VAR:default}` are replaced from the process environment.

Typical fields to inject:

- Licence Daemon: `licensing.host`, and when TLS is used `licensing.tls-config.trust-chain-file` (and related cert material)
- Geneos probe TLS: `instrumentation.geneos.tls-config.cert-file`, `key-file`, and when used `trust-chain-file`
- Host-specific values such as certificate paths or Licence Daemon hostnames when they differ by environment

```yaml
licensing:
  host: ${env:TRG_LICD_HOST:licd.example.com}
  port: 7041
  tls: true
  tls-config:
    trust-chain-file: ${env:LICD_TRUST_CHAIN:/certs/licd-ca.pem}

instrumentation:
  geneos:
    enabled: true
    listen-port: 7035
    probe-name: TRGatewayProbe
    managed-entity: tr-gateway
    sampler-name: TRGateway
    tls-config:
      cert-file: ${env:TRG_CERT:/certs/tr-gateway.crt}
      key-file: ${env:TRG_KEY:/certs/tr-gateway-key.pem}
```

Set the variables in the process environment before starting TR Gateway (for example, in the systemd unit, Windows service environment, or shell). See also [Trading Session Gateway](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html).

## Top-level configuration

The keys in this table are the root of `tr-gateway.yaml`.

| Key | Type | Description |
| --- | --- | --- |
| `data-dir` | string | File-ingestion root. TR Gateway ingests and tails the log files under this directory itself, without the file streamer. This is the file lane that the offline instance uses. Omit to run streaming-only (no file tailing). See [Ingestion lanes](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#ingestion-lanes). |
| `data-dir-sources` | map of subdirectory to protocol | Pins subdirectories of `data-dir` to a protocol family, so files in them skip protocol detection. See [`data-dir-sources`](#data-dir-sources).
Default: empty |
| `data-dir-ledger-file` | string | Path of a file that records which `data-dir` files are already ingested, so a restart does not ingest them again. See [`data-dir-ledger-file`](#data-dir-ledger-file).
Default: unset |
| `capture-group-pattern` | string (regex) | Regular expression that extracts the file group from each `data-dir` file name. See [`capture-group-pattern`](#capture-group-pattern).
Default: `_(M\d+)_` |
| `offline-log-analysis` | [OfflineLogAnalysisConfig](#offline-log-analysis) | Directory of log files that are listed for comparison and never ingested.
Default: unset |
| `perspective` | `SELL_SIDE` \| `BUY_SIDE` | Which side of the trade TR Gateway monitors. `SELL_SIDE` treats the monitored system as the venue: client orders are inbound and exchange replies are outbound. `BUY_SIDE` reverses both. This applies to streamed data. Files that TR Gateway reads from `data-dir` do not use it. For OUCH and SQF families that are listed in `protocol-dialects`, a message whose type shows it going to or coming from the venue takes its direction from that type, mapped through this setting. For FIX, the setting is used only when the file streamer supplies no direction and neither CompID matches `local-comp-id-prefixes`. The message type then sets the direction, except that session-level messages such as Logon and Heartbeat are always inbound. See [Local CompID prefixes](#local-compid-prefixes).
Default: `SELL_SIDE` |
| `local-comp-id-prefixes` | list of string | Self/local `SenderCompID` matchers for FIX direction orientation. See [Local CompID prefixes](#local-compid-prefixes). |
| `fix-sessions` | [FixSessionsConfig](#fix-sessions-and-drop-copy) | SubID-aware FIX session identity. Omit to key sessions on the CompID pair only. |
| `fix-dc` | [FixDcConfig](#fix-sessions-and-drop-copy) | FIX Drop Copy (`FIX-DC`) session classification. Omit to label every FIX session `FIX`. |
| `protocol-dialects` | [ProtocolDialectsConfig](#protocol-dialects) | Selects the dialect plugin that decodes each non-FIX protocol family. |
| `licensing` | [LicensingConfig](#licensing) | Connection to the Licence Daemon. Licenses each protocol family independently.
Mandatory: Yes |
| `tail-interval-ms` | long | File-tail poll interval for `data-dir` ingestion.
Default: `1000` |
| `rate-window-seconds` | int | Sliding window for rate metrics (Status UI and Geneos). Must be ≥ 1.
Default: `60` |
| `staleness-threshold-ms` | long | Age after which the status API marks a session as not active (`active` in `GET /api/sessions`). It does not set the Geneos STALE state, which uses `silence-threshold-seconds`.
Default: `30000` |
| `channels` | map of [ChannelConfig](#channels) | Per-channel streaming ingestion. |
| `search` | [SearchConfig](#search) | Optional message-search store. Omit the block or leave `data-dir` unset to disable. |
| `instrumentation` | [InstrumentationConfig](#geneos-instrumentation) | Geneos dataview publishing. |
| `status-server` | [StatusServerConfig](#status-server) | Built-in HTTP Status/Search UI and JSON API. Omit or set `enabled: false` to disable. |
| `storage` | [StorageConfig](#storage) | Bounded in-memory capacity and FIX ack-latency SLO tuning. |
| `sequence-gaps` | [SequenceGapsConfig](#sequence-gaps) | Limits for the FIX and FIX-DC sequence-gap views, and the stored gap history. Omit the block to use the defaults. |
| `activity` | [ActivityConfig](#activity) | Per-second order and trade counters that feed the Trading Performance views. Omit the block to use the defaults. |
| `reference` | [ReferenceConfig](#reference) | Display names for market segments. |
| `error-alerting` | [ErrorAlertingConfig](#error-alerting) | Real-time broker error/reject detection and TradeErrors dataviews. Omit the block to leave the feature off. |
| `schedules` | [SchedulesConfig](#schedules) | Operational schedule windows and holiday calendars. |
| `end-of-day-cleanup` | [EndOfDayCleanupConfig](#end-of-day-cleanup) | Global daily KPI / order-state reset. |
| `fix-connection` | [FixConnectionConfig](#fix-connection) | Tuning for the `Connected` state of sessions. |

## File lane settings

These keys control the file lane, which ingests and tails the files under `data-dir`. They have no effect on records that arrive from the file streamer. For the lanes, see [Ingestion lanes](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#ingestion-lanes).

### data-dir-sources

An optional map of `data-dir` subdirectory names to protocol families (`FIX`, `OUCH`, `SQF` or `DROP`, in any case). TR Gateway ingests the files in a pinned subdirectory as the mapped family, without inspecting the file content or name. Use it for files whose names carry no protocol convention. Files directly under `data-dir` keep protocol detection.

```yaml
data-dir: /opt/data/offline
tail-interval-ms: 1000
data-dir-sources:
  fix: FIX
  ouch: OUCH
  sqf: SQF
  drop: DROP
```

- With `tail-interval-ms` above `0`, TR Gateway picks up new files that you drop into a pinned subdirectory while it runs. It reads a file only after its size and modification time are unchanged across two polls, so a file that is still being copied is never read half-way.
- TR Gateway ingests each file at most once per run.
- A file in a `FIX` subdirectory that holds no length-prefixed records is read as a text FIX log. In the other subdirectories, TR Gateway skips such a file with a warning.
- An unknown protocol name, or a subdirectory key that looks like a path, stops TR Gateway at startup.

TR Gateway classifies files outside a pinned subdirectory by their content. A protocol is chosen only when it clearly dominates the records sampled. SQF files cannot be detected from their content, so put them in a pinned subdirectory. A file that TR Gateway cannot classify is reported with guidance to move it to a protocol subdirectory. TR Gateway does not ingest it.

### data-dir-ledger-file

Path of a file that records the files TR Gateway has ingested. It is unset by default, so a restart scans `data-dir` again and ingests every file again. FIX rows are de-duplicated, but OUCH, SQF and DROP rows are not, so the same file ingested twice doubles its rows. Files read through an OUCH dialect plugin also double, because each record is stamped with the time the file is read.


**Important**


Set `data-dir-ledger-file` if TR Gateway can restart while `data-dir` still holds files that it has already ingested. Use a writable path **outside** `data-dir`. If the ledger is inside `data-dir`, TR Gateway scans the ledger itself.



- TR Gateway records a file when it is ingested, and skips it on later runs.
- A file that has changed since it was recorded is ingested again, so a growing FIX text log stays covered.
- Files that were empty, unclassified or failed are not recorded, so TR Gateway examines them again on the next run.
- After a restart, recorded files show as `PREVIOUS_RUN` in the **Offline Ingest Status** dataview.

OUCH files carry no time for each record, so TR Gateway stamps every record of a file with the time the file is read. Ingest OUCH files on their trading day. A file read on a later day is stored and counted under the day it was read.

### capture-group-pattern

A regular expression with one capturing group. TR Gateway applies it to the base name of each file under `data-dir`. Group 1 of the first match is the file group: the part of the file name that identifies one day's file for a connection. For example, with the default pattern, the file `PREFIX_M123456789_SUFFIX_IN_X.log` has the file group `M123456789`.

TR Gateway uses the file group to keep OUCH and SQF conversations apart, because order tokens can be reused on different days.

| Key | Type | Description |
| --- | --- | --- |
| `capture-group-pattern` | string (regex) | Pattern with one capturing group.
Default: `_(M\d+)_` |

- Write the pattern in single quotes, for example `'_(M\d+)_'`. In double quotes, `\d` is an invalid escape.
- Leave the key unset to keep the default. Set it to a blank value to turn extraction off.
- A file whose name does not match the pattern has no file group. TR Gateway logs this once for `data-dir`, because several days of OUCH files loaded together cannot then be separated.
- On the `data-dir` lane, the session of an OUCH, SQF, or DROP file is the base-name text before the capture group. When the name has no group, or nothing before the group, the session is the text before the first `_`.
- Load the files of a multi-day order (good-till-cancel or good-till-date) together, or oldest day first. An older day loaded after a newer one splits the order in two.
- Feed one connection through one route at a time, `data-dir` or the file streamer, not both.
- Changing the pattern changes the conversation keys of data that you ingest afterwards, compared with data that is already stored. Keep the setting stable, or clear the stored data when you change it.

## Offline log analysis

YAML key: `offline-log-analysis`

An optional block that points at a directory of log files for comparison. TR Gateway lists the files so that you can compare them with the **Compare with file** command. It never ingests them, and they do not appear in **Offline Ingest Status** or in `GET /api/ingest/status`. The directory is independent of `data-dir`. Omit the block to turn the feature off.

```yaml
offline-log-analysis:
  data-dir: /opt/data/compare
  scan-interval-ms: 10000
  data-dir-sources:
    fix: FIX
    ouch: OUCH
    sqf: SQF
    drop: DROP
```

| Field | Type | Description |
| --- | --- | --- |
| `data-dir` | string | Root directory of the log files.
Required to turn the feature on. If the key is missing or blank, the feature is off and TR Gateway reports no error. |
| `scan-interval-ms` | long | How often TR Gateway scans the directory for the **Log Compare Files** dataview. Must be ≥ 1.
Default: `10000` |
| `data-dir-sources` | map of subdirectory to protocol | Pins subdirectories to a protocol family. It follows the same rules as [`data-dir-sources`](#data-dir-sources). Files directly under `data-dir` are treated as FIX.
Default: empty |

When `instrumentation.geneos` is enabled, the **Log Compare Files** dataview lists each regular file directly under `data-dir`, and each regular file directly under a subdirectory named in `data-dir-sources`. The columns are `File`, `Protocol`, `Size`, and `Modification Time`, and the headline is `TotalFiles`. The compare commands attach to its rows.

## Protocol dialects

YAML key: `protocol-dialects`

Maps each protocol family to the dialect plugin that parses it:

```yaml
protocol-dialects:
  ouch: ${env:TRG_OUCH_DIALECT}   # dialect value from your ITRS account manager
  sqf: ${env:TRG_SQF_DIALECT}     # remove if you do not run SQF
  drop: ${env:TRG_DROP_DIALECT}   # remove if you do not run DROP
```

Each `${env:...}` variable stands in for the dialect value that ITRS supplies for that family. The shipped `tr-gateway.yaml` already lists these values for your package, so you can keep them. Otherwise, set the variables in the service environment, as the install steps describe. The dialects you can use depend on your package and license. Contact your ITRS account manager to confirm which protocol families you can run, and for the dialect value to set for each family in `protocol-dialects`.


**Important**


Set the environment variable for every family you keep. An unset variable becomes an empty string, and TR Gateway stops at startup with `protocol-dialects: no plugin found for dialect ''`. A dialect that is not installed with your package stops startup with the same message. Copying the example without setting these variables breaks the deployment.



No FIX entry is required. The built-in FIX identity plugin is used by default. Required when you stream a non-FIX family and want dialect normalization, correlation, and per-protocol dataviews.


**Important**


If a family is mapped to an unknown dialect, or to a dialect for the wrong family, TR Gateway fails at startup. If a streamed family has no entry, licensed records use the built-in raw family parser. That parser decodes one fixed venue layout, so a feed from another venue is misparsed. The rows are available only in the native search tables.



The dialect must match the wire format sent by the file streamer. A dialect for a different wire format parses the feed incorrectly even when both dialects belong to the same protocol family.

## Local CompID prefixes

YAML key: `local-comp-id-prefixes`

```yaml
local-comp-id-prefixes:
  - "VENUE"
  - "LOCAL.*"
```

Each entry is a literal prefix or regular expression for TR Gateway's own (local) FIX CompIDs. TR Gateway also derives the display-only `counterparty` and `role` session attributes from the same matchers.

For streamed FIX, TR Gateway decides the direction of each message in this order:

1. A direction that the file streamer supplies. This is a `direction` property on the record or, for plain-text logs, the QuickFIX/J `incoming` or `outgoing` marker in the log line prefix.
2. The CompIDs. If the `SenderCompID` (tag 49) matches an entry, the message is outbound. If the `TargetCompID` (tag 56) matches, it is inbound.
3. The message type and the [`perspective`](#top-level-configuration) setting. Session-level messages such as Logon and Heartbeat are always inbound.

The `data-dir` file lane does not use this list. For a FIX text log, it uses the QuickFIX/J marker when the line has one. Otherwise, and for length-prefixed binary FIX files, FIX direction comes from the file name: a name that contains `_IN_` is inbound, and any other name is outbound.

Required when you stream FIX and need reliable inbound and outbound direction labeling.


**Important**


An empty or missing list does not stop TR Gateway at startup. If the file streamer supplies no direction and the list is empty, direction is inferred from the message type. Wrong or missing prefixes can mislabel inbound and outbound traffic and break per-session sequence tracking.



## FIX sessions and drop copy

YAML keys: `fix-sessions` and `fix-dc`

The `fix-sessions` and `fix-dc` blocks control FIX session identity and FIX Drop Copy (`FIX-DC`) classification. Both blocks are optional. If you omit them, TR Gateway keys sessions on the CompID pair only and labels every FIX session `FIX`.

`FIX-DC` is a classification of a FIX session, not a separate protocol family. Drop-copy sessions use the FIX license and the shared `fix` search table. For more information, see [FIX drop copy sessions](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#fix-drop-copy-sessions).

```yaml
fix-sessions:
  subid-split: true

fix-dc:
  subid-pattern: ".*JDA.*"
  classify-by-traffic: false
  tag-names:
    29076: TradeSubType
```

### FIX sessions

YAML key: `fix-sessions`

| Field | Type | Description |
| --- | --- | --- |
| `subid-split` | boolean | When this setting is `true`, `SenderSubID` (tag 50) and `TargetSubID` (tag 57) form part of the FIX session identity alongside the CompID pair. If one CompID pair carries both order-entry and drop-copy SubIDs, TR Gateway resolves them to separate sessions instead of one.
Default: `false` |

### FIX drop copy

YAML key: `fix-dc`

TR Gateway classifies a session as `FIX-DC` in the following order of precedence: the [`session-class: drop-copy`](#channels) setting on the channel, a `subid-pattern` match, then traffic evidence when `classify-by-traffic` is enabled. Classification is one-way. After TR Gateway classifies a session, the session keeps that label for its lifetime.

| Field | Type | Description |
| --- | --- | --- |
| `subid-pattern` | string | Regular expression that is matched against `SenderSubID` (tag 50) and `TargetSubID` (tag 57). The whole SubID must match, so use `.*JDA.*` to match JDA anywhere in it. A match labels the session `FIX-DC`. |
| `classify-by-traffic` | boolean | Labels a session `FIX-DC` from drop-copy traffic alone, without a SubID match. Qualifying traffic is a `TradeCaptureReportRequest`, `TradeCaptureReportRequestAck`, or `OrderMassStatusRequest` message, or any message with `CopyMsgIndicator` (tag 797) set to `Y`.
Default: `false` |
| `tag-names` | map of int to string | Display names for custom FIX tags that the shared FIX dictionary does not name. TR Gateway uses these names only when it renders messages in the Status UI, the Search UI, and search results. These names never override a tag that is already in the dictionary, and they do not make a tag searchable. |


**Important**


Set `fix-sessions.subid-split: true` whenever you set `fix-dc.subid-pattern`. If you do not, a connection that carries both order-entry and drop-copy traffic under one CompID pair is still keyed as a single session. The `FIX-DC` label then flips from message to message instead of separating the traffic into two sessions. TR Gateway logs a warning at startup but still starts.



Classification from a channel (`session-class: drop-copy`) or from traffic evidence does not depend on SubID splitting.

TR Gateway writes drop-copy rows to the shared `fix` table with a `sessionClass` value of `DC`. Filter on `sessionClass` in Active Console or through the HTTP API, and use the **Search FIX-DC Messages** command to open a view that is scoped to drop-copy sessions. Rows that were written before a session was classified from traffic evidence keep `sessionClass` unset. TR Gateway does not relabel those rows later.

## Licensing

YAML key: `licensing`

Mandatory top-level block. Connects TR Gateway to the Licence Daemon. Each protocol family starts decoding only after the Licence Daemon grants its token. Write these keys in kebab-case. The camelCase names in the shipped files also work.

| Field | Type | Description |
| --- | --- | --- |
| `demo-mode` | boolean | When `true`, grant every protocol family token locally for seven days, with no Licence Daemon.
Default: `false` |
| `host` | string | Hostname or IP of the Licence Daemon.
Mandatory: Yes, unless `demo-mode` is `true` |
| `port` | int | TCP port of the Licence Daemon.
Default: `7041` |
| `tls` | boolean | Use TLS for the Licence Daemon connection. Certificate material in `tls-config` also enables TLS.
Default: `false` |
| `tls-config` | [TlsConfig](#licensing-tls-configuration) | Client TLS for the Licence Daemon connection. See [Licensing TLS configuration](#licensing-tls-configuration). |
| `heartbeat-interval-ms` | int | Heartbeat interval for the Licence Daemon connection.
Default: `30000` |
| `auto-reconnect` | boolean | Reconnect automatically after a Licence Daemon disconnect.
Default: `true` |
| `instance-id` | string | Unique instance identity. When omitted, TR Gateway derives the value.
Default: derived |
| `initial-status-wait-ms` | long | Startup waits up to this long for the license to grant all four protocol families (`fix`, `ouch`, `sqf`, `drop`) before journal consumers start, whether or not you configure dialects. If a family is not granted, startup waits for the full time. A value of zero or less skips the wait.
Default: `30000` |

### Licensing TLS configuration

YAML key: `licensing.tls-config`

Optional TLS settings for the outbound Licence Daemon connection. TLS is enabled when `licensing.tls` is `true`, or when `cert-file` or `trust-chain-file` is set. The camelCase names in the shipped files also work.

| Field | Type | Description |
| --- | --- | --- |
| `cert-file` | string | Path to the client X.509 certificate PEM presented to the Licence Daemon. |
| `key-file` | string | Path to the matching PKCS#8 private key PEM (`BEGIN PRIVATE KEY`). Requires `cert-file`. |
| `trust-chain-file` | string | Path to a CA trust-chain PEM used to verify the Licence Daemon server certificate. |
| `min-tls-version` | string | Minimum TLS protocol version (`"1.2"` or `"1.3"`). Quote the value in YAML. Default: `"1.3"`. |

```yaml
licensing:
  host: ${env:TRG_LICD_HOST:licd.example.com}
  port: 7041
  tls: true
  tls-config:
    trust-chain-file: ${env:LICD_TRUST_CHAIN:/certs/licd-ca.pem}
    min-tls-version: "1.3"
```

For an evaluation without a Licence Daemon, omit `host` and set `demo-mode: true`:

```yaml
licensing:
  demo-mode: true
```

## Channels

YAML key: `channels`

Each entry under `channels:` is a named streaming-ingestion channel.


**Important**


A channel whose `type` is missing, or is anything other than `streaming`, is skipped without any log message. TR Gateway starts normally and the channel never opens its gRPC port.



| Key | Type | Description |
| --- | --- | --- |
| `type` | string | Channel kind. Must be `streaming`.
Mandatory: Yes |
| `protocol` | string | Protocol-family hint (`fix`, `ouch`, `sqf`, or `drop`). The file streamer stamps every event, and that stamp overrides this hint. Set `protocol` to `OUCH`, `SQF`, or `DROP` on each file streamer source. See [File streamer](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#file-streamer).
This hint applies only when the producer leaves the event unstamped. It then selects which `protocol-dialects` entry applies. With no stamp and no hint, TR Gateway identifies FIX, DROP, and OUCH records from their content. It reads an unstamped SQF record as OUCH, or skips it. Set `protocol: sqf` on a channel that carries unstamped SQF records. An unrecognized value produces no error, and TR Gateway falls back to content detection. |
| `grpc-port` | int | gRPC ingestion listen port.
Default: `0` (disabled) |
| `grpc-max-inbound-message-bytes` | int | Max decompressed size of one inbound batch.
Default: `67108864` (64 MiB) |
| `payload-encoding` | `utf-8` \| `base64` | Encoding of the record payloads in each inbound batch. The file streamer sends every protocol, including FIX, base64-encoded, so use `base64` for a channel that the file streamer feeds. The shipped streaming templates do this. Use `utf-8` only when the producer sends plain-text FIX log lines. An `encoding` value on an individual event overrides this channel setting for that event. Any other value stops startup.
Default: `utf-8` |
| `default-ouch-session-id` / `default-sqf-session-id` / `default-drop-session-id` | string | Session id when none is derivable.
Default: protocol name |
| `poll-interval-ms` | long | Consumer poll interval.
Default: `100` |
| `stop-timeout-ms` | long | Graceful-stop timeout.
Default: `5000` |
| `session-class` | string | Set to `drop-copy` to classify every FIX session on this channel as `FIX-DC`. Use it when a channel or port carries only drop-copy traffic. Takes precedence over the `fix-dc` matchers. See [FIX sessions and drop copy](#fix-sessions-and-drop-copy). |
| `journal` | block | Wire journal settings.
Default: when the block is missing and the channel sets `grpc-port`, the journal is written to `data/journals/<channel>`, relative to the directory that TR Gateway starts in. A streaming channel with neither a `journal` block nor a `grpc-port` is skipped, and TR Gateway logs a warning. |
| `tls-config` | block | TLS or mTLS for the gRPC ingestion port. Omit the block for plaintext. A block that sets any field without `cert-file` stops TR Gateway at startup. See [Channel TLS configuration](#channel-tls-configuration). |

### Journal fields

YAML key: `channels.<name>.journal`

| Key | Type | Description |
| --- | --- | --- |
| `directory` | string | Base directory for journal day-directories.
Mandatory: Yes |
| `rollover-time` | string | Time of day to roll to a new trading-day directory.
Default: `00:00` |
| `rollover-timezone` | string | IANA timezone for the rollover boundary. Set this to the venue trading-day zone. Examples use `America/New_York`.
Default: `UTC` |
| `retention-days` | int | Delete day-directories older than N days when retention is enabled.
Default: `5` |
| `retention-enabled` | boolean | Delete old day-directories on startup and after each roll. Set `false` to keep journals for external use.
Default: `true` |
| `max-file-length` | int | Maximum journal segment size in bytes.
Default: `16777216` (16 MB) |
| `capacity` | long | Maximum number of records in one trading-day journal. When the journal is full, TR Gateway refuses further appends and pushes back on the producer until the next rollover. A value that is too low caps daily ingestion. For the operator view of this behavior, see [Journal capacity and back-pressure](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#journal-capacity-and-back-pressure).
Default: `100000000` |
| `min-free-disk-mb` | long | Free-disk threshold for the journal volume, in MB. While usable space is below this, TR Gateway refuses further appends and pushes back on the producer. Appends resume when space frees. `0` disables the guard.
Default: `1024` |
| `flush-interval-ms` | long | Journal flush cadence in milliseconds.
Default: `100` |

### Channel TLS configuration

YAML key: `channels.<name>.tls-config`

TLS or mTLS for the gRPC ingestion port. TR Gateway is the TLS server and the file streamer's gRPC reporter is the client. Each channel has its own block and its own TLS context. TR Gateway reads the certificate files once, at startup.

Once `cert-file` is set, the port accepts TLS connections only, and the gRPC reporter must be configured to match. Plaintext reporters can no longer connect.


**Important**


Omit the whole block to keep the port plaintext. Unlike the Geneos probe, a channel block that sets any field without `cert-file` stops TR Gateway at startup with an error that names the channel. It never falls back to plaintext.



The block uses the same fields as [Geneos TLS configuration](#geneos-tls-configuration):

| Field | Type | Description |
| --- | --- | --- |
| `cert-file` | string | Path to the server X.509 certificate PEM. When set, the port accepts TLS only. The certificate's subject alternative name (SAN) must match what the reporter connects to: a DNS name, or an IP SAN when the reporter uses an IP address. |
| `key-file` | string | Path to the matching PKCS#8 private key PEM (`BEGIN PRIVATE KEY`). Optional. When omitted, TR Gateway reads the key from `cert-file` (a combined PEM). |
| `trust-chain-file` | string | Path to a CA trust-chain PEM used to verify the reporter client certificate (mTLS). Accepted only together with `require-client-auth: true`. |
| `require-client-auth` | boolean | When `true`, reject reporters that do not present a certificate trusted by `trust-chain-file` (mutual TLS). Requires `trust-chain-file`.
Default: `false` |
| `min-tls-version` | string | `"1.2"` enables TLS 1.2 and 1.3. `"1.3"` enables TLS 1.3 only. Quote the value in YAML.
Default: `"1.3"` |

Use a dedicated CA, or an intermediate CA, for `trust-chain-file`. Mutual TLS accepts any certificate that chains to it.

```yaml
channels:
  fix:
    type: streaming
    grpc-port: 9500
    payload-encoding: base64
    tls-config:
      cert-file: ${env:TRG_INGEST_CERT:/certs/tr-gateway.crt}
      key-file: ${env:TRG_INGEST_KEY:/certs/tr-gateway-key.pem}
      trust-chain-file: ${env:TRG_INGEST_TRUST_CHAIN:/certs/rootCA.pem}
      require-client-auth: true
```

Configure the file streamer's gRPC reporter (`GrpcInternalIngestionServiceReporter`) to match. Set `usePlainText: false`, and set `tlsConfig` with `trustChainFile` so that the reporter verifies TR Gateway. For mTLS, also set `certFile` and `keyFile`. The reporter ignores `tlsConfig` while `usePlainText` is `true`. For the reporter settings, see [File Streamer Collection Agent plugin](https://docs.itrsgroup.com/docs/geneos/collection/file-streamer/current/user-guide/file-streamer/index.html).

TR Gateway logs `Configured gRPC ingestion for channel <name> on port <port> (plaintext|TLS|mTLS)` at startup. Use it to confirm the mode in effect.

## Search

YAML key: `search`

Optional message-search subsystem. Stores received messages in an embedded store for retrieval through `GET /api/search` and the Geneos Search Messages command. Omit the section or leave `data-dir` unset for zero footprint.


**Note**


Enabling search uses native memory outside `-Xmx`. Size the host limit with headroom. See [Host sizing](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#host-sizing).



| Key | Type | Description |
| --- | --- | --- |
| `data-dir` | string | Filesystem directory for the embedded search store. Created if absent. Separate from ingestion `data-dir`. |
| `ring-size` | int | Apply-to-writer ring capacity in bytes. TR Gateway rounds the value up to a power of two. The value is not a number of entries. Leave this setting out unless support advises otherwise. A small value makes the ring drop messages under load (see the `Dropped` headline on [Search Monitoring](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#search-monitoring)).
Default: `67108864` (64 MiB) |
| `retention-days` | int | Drop day partitions older than this (must be ≥ 1).
Default: `30` |
| `daily-retention-days` | int | Retention, in days, for the daily activity table (`activity_1d`). It does not apply to the message and order tables, which use `retention-days`. Must be ≥ 1.
Default: `400` |
| `min-free-disk-mb` | long | Free-disk threshold for the search volume, in MB. Search writes pause while usable space on the volume is below this, and resume when space frees. The **SearchFull** headline on [Search Monitoring](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#search-monitoring) shows the pause. `0` disables the guard. TR Gateway then warns at startup that a full search volume crashes the process with SIGSEGV inside QuestDB. It also warns when this value is not above `journal.min-free-disk-mb` for a channel. On a shared volume, keep it above every journal threshold so search pauses before the journal refuses appends.
Default: `4096` |
| `retention-time` | string | Daily retention-sweep time of day.
Default: `01:00` |
| `retention-zone` | string | Time zone for the sweep.
Default: `UTC` |
| `wal-apply-interval-ms` | long | Idle-sleep interval for the background WAL-apply worker (must be ≥ 1).
Default: `1000` |
| `console-port` | int | Optional embedded QuestDB web-console port. Unauthenticated — do not enable in production.
Default: `0` (disabled) |
| `custom-tags` | list | Extra FIX tags promoted to searchable columns (`tag`, `column-name`, `type`). `type` must be `SYMBOL`, `DOUBLE`, `LONG` or `TIMESTAMP`, in any case. Any other value stops startup.
Default: `[]` |

## Geneos instrumentation

YAML key: `instrumentation.geneos`

TR Gateway listens on `listen-port` acting as a Netprobe. Geneos Gateway connects to that port and pushes sampler configuration. Dataview publishing activates after the probe receives a sampler that uses the API Streams plugin (from the Gateway XML element `<api-streams/>`). For probe, managed entity, and sampler setup on the Geneos side, see [Configure the Gateway Setup Editor](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#configure-the-gateway-setup-editor). For listen-socket TLS fields, see [Geneos TLS configuration](#geneos-tls-configuration).

| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | Enable Geneos dataview publishing.
Default: `false` |
| `listen-port` | int | TCP port on which TR Gateway listens for the Geneos Gateway connection.
Default: `0`
Mandatory: Yes if enabled |
| `probe-name` | string | Netprobe name registered in the Gateway configuration.
Mandatory: Yes if enabled |
| `managed-entity` | string | Managed entity name under which dataviews are published.
Mandatory: Yes if enabled |
| `sampler-name` | string | Sampler name used for the published dataviews.
Mandatory: Yes if enabled |
| `self-monitoring-interval-ms` | long | Publish interval for self-monitoring dataviews (ms).
Default: `10000` |
| `domain-interval-ms` | long | Publish interval for trading dataviews (ms).
Default: `5000` |
| `activity-interval-ms` | long | Publish interval for the Trading Performance dataviews (ms). Must be ≥ 1 when Geneos is enabled.
Default: `1000` |
| `activity-views` | boolean | Publish the `<LABEL>-TradingPerformance` and **Trading Performance Summary** dataviews. They need the [`activity`](#activity) counters to be active. If the counters are inactive, TR Gateway does not publish these views.
Default: `true` |
| `jvm-metrics` | boolean | Publish the JVM **Self Monitoring** dataview. Set `false` to keep Geneos enabled without that loop.
Default: `true` |
| `tls-config` | block | TLS or mTLS for the probe listen socket. Omit (or omit `cert-file`) for plaintext. See [Geneos TLS configuration](#geneos-tls-configuration). |
| `search-commands` | block | Geneos search commands and their results dataviews. Requires active [Search](#search). See [Search commands](#search-commands).
Default: disabled |
| `protocol-groups` | map of protocol label to string | Renames the Geneos group (folder) that holds a protocol's dataviews. Keys are protocol labels: `FIX`, `FIX-DC`, `OUCH`, `SQF` or `DROP`. TR Gateway stops at startup if a label is not one that the deployment publishes, if a name is blank or contains a double quote, if a name is the reserved `Trading Performance`, or if two protocols share a name. See [Protocol groups](#protocol-groups).
Default: empty (each group takes the protocol label) |
| `status` | block | Settings for the per-protocol `<LABEL>-Status` dataview. See [Status dataview settings](#status-dataview-settings).
Default: enabled, with the defaults in that section |

```yaml
instrumentation:
  geneos:
    enabled: true
    listen-port: 7035
    probe-name: TRGatewayProbe
    managed-entity: tr-gateway
    sampler-name: TRGateway
    self-monitoring-interval-ms: 10000
    domain-interval-ms: 5000
```

### Protocol groups

TR Gateway publishes the dataviews of each protocol in one Geneos group, named after the protocol label. Set `protocol-groups` to show a different folder name:

```yaml
instrumentation:
  geneos:
    protocol-groups:
      FIX: Order Entry
```

Renaming a group changes the display only. The dataviews keep the protocol label as a name prefix, for example **FIX-KPIs**. The command anchors that TR Gateway publishes follow the renamed group automatically. Geneos rules that select dataviews by group name do not, so update the `Group` conditions in your rules when you rename a group. See [Include rules](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#include-rules).

### Status dataview settings

YAML key: `instrumentation.geneos.status`

Each protocol group holds a `<LABEL>-Status` dataview, for example **FIX-Status**. TR Gateway creates it on the first publish cycle even when the protocol has no sessions, so a protocol that is configured but silent appears as `NO_DATA` instead of being absent. The view has one row, named for the protocol label.

| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | Publish a `<LABEL>-Status` dataview in each protocol group. Set `false` to publish none.
Default: `true` |
| `rate-window-seconds` | int | Trailing window for the `CurrentMps` column. Must be ≥ 1 and no greater than the top-level `rate-window-seconds`.
Default: `10` |
| `latency-window-seconds` | int | Trailing window for the minimum, 99th percentile and maximum acknowledgment latency. Must be ≥ 1.
Default: `30` |
| `silence-threshold-seconds` | int | How long a protocol that is inside its trading window can go without a message before its feed is `STALE`. Must be ≥ 1.
Default: `30` |
| `silence-threshold-overrides` | map of protocol label to int | Replaces `silence-threshold-seconds` for one protocol. The key must be a protocol label this deployment publishes. FIX is always published. OUCH, SQF, and DROP are published only when `protocol-dialects` maps that family. Any other key stops TR Gateway at startup with `unknown protocol '<label>'`. Values must be ≥ 1.
Default: empty |
| `trading-windows` | map of protocol label to string | The name of a schedule under [`schedules.operational-schedules`](#schedules) for each protocol. The key follows the same protocol-label rule as `silence-threshold-overrides`. Outside that schedule, the feed is `IDLE`. A protocol with no entry is always in its trading window. A blank or unknown schedule name stops TR Gateway at startup.
Default: empty |

TR Gateway stops at startup, and names the key, when a value breaks one of these rules.

```yaml
instrumentation:
  geneos:
    status:
      enabled: true
      rate-window-seconds: 10
      latency-window-seconds: 30
      silence-threshold-seconds: 30
      silence-threshold-overrides:
        FIX: 300
      trading-windows:
        FIX: venue-session
```

`venue-session` is the schedule in the [complete configuration](#complete-configuration). Define that schedule in this file. An unknown schedule name stops TR Gateway at startup. Use an OUCH, SQF, or DROP label in either map only when `protocol-dialects` maps that family.

The `<LABEL>-Status` dataview has the columns `Protocol`, `CurrentMps`, `PeakMps`, `TotalMessages`, `ConnectedSessions`, `Sessions` and `InSchedule`. The latency columns `MinAckLatencyMs`, `P99AckLatencyMs`, `MaxAckLatencyMs` and `MaxLatencyHolder` appear only where acknowledgment latency can be measured: for FIX, and for SQF when its dialect plugin measures it. FIX-DC, OUCH and DROP never have them. `PeakMps`, `TotalMessages` and the latency window reset at the end-of-day reset.

The `feedStatus` headline has one of four values, checked in this order:

| Value | Meaning |
| --- | --- |
| `IDLE` | The protocol is outside its `trading-windows` schedule. |
| `NO_DATA` | The protocol is inside its schedule and no message has arrived since startup or the end-of-day reset. |
| `STALE` | The protocol is inside its schedule and the last message is older than the silence threshold. |
| `RECEIVING` | The protocol is inside its schedule and the last message is within the silence threshold. |

After the end-of-day reset, a protocol shows `NO_DATA` until its first message. Set `trading-windows` for each published protocol so that it shows `IDLE` outside trading hours instead.

### Geneos TLS configuration

YAML key: `instrumentation.geneos.tls-config`

TLS or mTLS for the Geneos probe listen socket. TR Gateway is the TLS server. Geneos Gateway is the client. Licence Daemon client TLS is [`licensing.tls-config`](#licensing-tls-configuration). It uses the same kebab-case key names. The camelCase names in the shipped files also work.

| Mode | TR Gateway | Geneos Gateway |
| --- | --- | --- |
| Plaintext | No `tls-config` / no `cert-file` | Probe without `<secure>` |
| TLS | `cert-file` + `key-file` | `<secure>true</secure>` and Gateway SSL identity that trusts the signing CA |
| mTLS | TLS + `trust-chain-file` + `require-client-auth: true` | Same as TLS. Gateway presents a client certificate. |

| Field | Type | Description |
| --- | --- | --- |
| `cert-file` | string | Path to the probe X.509 certificate PEM. When set, TR Gateway presents this certificate on the listen socket. |
| `key-file` | string | Path to the matching PKCS#8 private key PEM (`BEGIN PRIVATE KEY`). PKCS#1 keys are not supported. Optional. When omitted, TR Gateway reads the key from `cert-file` (a combined PEM). |
| `trust-chain-file` | string | Path to a CA trust-chain PEM used to verify the Gateway client certificate (mTLS). Required when `require-client-auth` is `true`. |
| `require-client-auth` | boolean | When `true`, require a client certificate trusted by `trust-chain-file` (mutual TLS).
Default: `false` |
| `min-tls-version` | string | Minimum TLS protocol version (`"1.2"` or `"1.3"`). Quote the value in YAML.
Default: `"1.3"` |

TLS example:

```yaml
instrumentation:
  geneos:
    enabled: true
    listen-port: 7035
    probe-name: TRGatewayProbe
    managed-entity: tr-gateway
    sampler-name: TRGateway
    tls-config:
      cert-file: /path/to/tr-gateway.crt
      key-file: /path/to/tr-gateway-key.pem
      min-tls-version: "1.3"
```

mTLS example:

```yaml
instrumentation:
  geneos:
    enabled: true
    listen-port: 7035
    probe-name: TRGatewayProbe
    managed-entity: tr-gateway
    sampler-name: TRGateway
    tls-config:
      cert-file: /path/to/tr-gateway.crt
      key-file: /path/to/tr-gateway-key.pem
      trust-chain-file: /path/to/rootCA.pem
      require-client-auth: true
      min-tls-version: "1.3"
```

On the Geneos Gateway side, mark the probe secure and supply SSL identity plus a CA chain that trusts the probe certificate. For example:

```text
gateway2.linux_64 ... \
  -ssl-certificate /path/to/gateway.pem \
  -ssl-certificate-key /path/to/gateway-key.pem \
  -ssl-certificate-chain /path/to/rootCA.pem
```

For the probe XML and Gateway Setup Editor steps, see [Add the probe](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#add-the-probe).

### Search commands

YAML key: `instrumentation.geneos.search-commands`

Publishes the Geneos search commands when [`search`](#search) is also active (`data-dir` set). This includes the message searches, **Search Latency**, **Search Orders**, **Search Trades**, sequence-gap search, **Review Activity**, and **Show Session Status History**. Each command still appears only when its own condition holds. TR Gateway publishes the commands itself, so you do not define them in the Geneos Gateway setup. Matching records populate results dataviews such as `FIX-Search-Results-NNN`. For setup and Active Console usage, see [Search messages](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#search-messages).

`enabled` turns on the search commands, and the Show Conversation commands that the probe publishes itself. See the [command catalogue](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#search-command-catalogue). **Search FIX Messages** and **Search Latency** are always published. Native-protocol commands are published only when that family has a dialect in [`protocol-dialects`](#protocol-dialects). **Search FIX-DC Messages** is published when [`fix-dc.subid-pattern`](#fix-sessions-and-drop-copy) is set, when `fix-dc.classify-by-traffic` is `true`, or when a channel sets [`session-class: drop-copy`](#channels).


**Important**


`max-rows` no longer exists. The configuration loader rejects unknown keys, so a file that still sets `search-commands.max-rows` stops TR Gateway at startup. Remove the key. The row limit is now the **Row limit** input on each search command, pre-filled with `limit=200`. A larger value is reduced to `1000`.



| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | Enable the search commands. Requires active [Search](#search).
Default: `false` |
| `results-dataview-name` | string | Suffix in every search results dataview name. Message views are `<LABEL>-<suffix>-NNN`, for example `FIX-Search-Results-001`. The same suffix names `Latency-<suffix>-NNN`, `<LABEL>-Orders-<suffix>-NNN`, `All-Orders-<suffix>-NNN`, `Trades-<suffix>-NNN`, `Activity-<suffix>-NNN`, and `<LABEL>-Gap-<suffix>-NNN`. **Clear This Search Result** is available on any dataview whose name matches `*-<suffix>-*`.
Default: `Search-Results` |
| `max-result-views` | int | Number of results views kept per slot. Each search attempt publishes its own results view. When a new search exceeds this number, TR Gateway removes the oldest view.
Default: `5` |
| `query-timeout-ms` | long | Maximum time the dialog box waits for the query.
Default: `10000` |
| `default-lookback-minutes` | int | Lookback window, in minutes, for message searches and **Search Latency** when the operator leaves `from` blank. **Search Orders**, **Search Trades**, **Search FIX Sequence Gaps**, **Search FIX-DC Sequence Gaps**, **Review Activity**, and **Show Session Status History** start at the trading-day boundary when `from` is blank.
Default: `30` |

```yaml
instrumentation:
  geneos:
    enabled: true
    search-commands:
      enabled: true
      results-dataview-name: Search-Results
      max-result-views: 5
      query-timeout-ms: 10000
      default-lookback-minutes: 30
```

## Status server

YAML key: `status-server`

Built-in HTTP server for the Status/Search UI and JSON API. See [Status UI](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#status-ui).

| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | Enable the Status/Search UI HTTP server.
Default: `false` |
| `port` | int | HTTP listen port.
Default: `8080` |
| `bind-address` | string | Address on which the HTTP server listens: an IP literal such as `127.0.0.1`, or a host name of this host. Unset, the server listens on every interface. Set it to `127.0.0.1` unless another host must reach the UI. The address must belong to this host. If it does not, TR Gateway fails at startup. |


**Important**


The Status UI and JSON API have no authentication and no TLS. Bind them to `127.0.0.1`, and reach them remotely through an SSH tunnel or an authenticating reverse proxy.



## Storage

YAML key: `storage`

In-memory order-store capacities and the FIX ack-latency SLO windows used by **FIX-Latency** and the slow-order search default threshold.

| Field | Type | Description |
| --- | --- | --- |
| `correlation-ttl-seconds` | int | Seconds a terminal conversation lingers before eviction. Must be ≥ 1.
Default: `60` |
| `correlation-sweep-interval` | int | Apply-count cadence for the correlation eviction sweep. Must be ≥ 1.
Default: `1024` |
| `correlation-idle-ttl-seconds` | int | Idle backstop for conversations without terminal detection (for example, quotes). Must be ≥ 1, and must also be ≥ `correlation-ttl-seconds`. TR Gateway checks the second rule when it creates a trading session, so a value that breaks it can pass startup and then fail when the first session for a feed appears.
Default: `86400` |
| `correlation-key-history` | int | How many retired identifiers of each kind a conversation keeps, in addition to the identifiers that the live order currently uses. Retired identifiers are superseded ClOrdIDs or order tokens, ExecIDs, status request IDs, and the identifiers of orders that have ended. Set `-1` to keep all of them, otherwise the value must be ≥ 1. See [Long-lived orders](#long-lived-orders).
Default: `32` |
| `exec-id-capacity` | int | Maximum remembered exec IDs for deduplication. The limit applies to each session.
Default: `50000` |
| `ouch-detector-capacity` | int | Maximum number of entries in the duplicate detector that each OUCH session keeps, keyed on the order token and message type. When the detector is full, TR Gateway evicts the least recently used entry.
Default: `100000` |
| `latency-threshold-ms` | int | SLO threshold and default `minLatencyMs` for slow-order search. Must be ≥ 0.
Default: `100` |
| `latency-short-window-seconds` | int | Short rolling window for within-SLO ratio on **FIX-Latency**. Must be ≥ 1.
Default: `10` |
| `latency-long-window-seconds` | int | Long rolling window for within-SLO ratio on **FIX-Latency**. Must be ≥ `latency-short-window-seconds`.
Default: `300` |
| `latency-cap-seconds` | int | Anomaly cap on a single latency sample. TR Gateway discards samples at or above this value instead of counting them, so a very slow sample does not distort the SLO windows. The value does not age samples out of the windows. Must be ≥ 1.
Default: `60` |

### Long-lived orders

An order that rests all day and is amended many times, such as a market maker's quote, collects a new ClOrdID (OUCH order token) with every amendment and an ExecID with every execution report. TR Gateway therefore keeps every identifier that a live order is currently known by, and only the latest `correlation-key-history` retired identifiers of each kind. This keeps the memory for each conversation bounded however often an order is amended or a quote is hit.

A message that names only identifiers that TR Gateway has already trimmed cannot join its conversation in memory, and starts a new conversation. When search is on, TR Gateway recovers replace, cancel and correction messages from the search store. Raise `correlation-key-history` if your clients send replace requests that refer to an order many amendments back.

The `<LABEL>-SingleOrders` dataview shows `KeysTrimmed` (identifiers that TR Gateway trimmed) and `TrimmedKeyMisses` (messages that named only trimmed identifiers) for each session and day.

## Sequence gaps

YAML key: `sequence-gaps`

Limits for the FIX and FIX-DC sequence-gap tracking behind the **FIX-SequenceGaps** and **FIX-DC-SequenceGaps** dataviews. A missing block uses the defaults.

| Field | Type | Description |
| --- | --- | --- |
| `max-open-per-direction` | int | Memory guard. When a direction reaches this number of open gaps, TR Gateway closes the oldest open gap as `Unrecovered`. Must be ≥ 1.
Default: `1000` |
| `max-closed-per-direction` | int | Closed (`Recovered` or `Unrecovered`) gaps kept for each connection and direction. TR Gateway drops the oldest first. Must be ≥ 1.
Default: `20` |
| `closed-gap-retention-ms` | long | Drops closed gaps whose close time is older than this, measured in message time. When unset, closed gaps stay until the end-of-day reset. Must be ≥ 1.
Default: unset |
| `hint-reset-tolerance-ms` | long | A hint from the other side of the connection (a ResendRequest, or the next expected number in a Logon) that arrives up to this long before a sequence reset counts for the numbers after the reset. It absorbs small clock differences between the two engines around a reconnect. `0` means no tolerance. Must be ≥ 0.
Default: `1000` |
| `history-enabled` | boolean | Stores every gap in the search store and publishes the **Search FIX Sequence Gaps** and **Search FIX-DC Sequence Gaps** commands. It has no effect unless [`search`](#search) is active, and the commands also need [`search-commands`](#search-commands) enabled.
Default: `true` |
| `history-flush-interval-ms` | long | How often TR Gateway writes changed gaps to the search store. It writes a gap at once when the gap opens and when it closes. Other changes, such as partial fills, are batched and written at most once for each interval. TR Gateway checks the value even when history is off. Must be ≥ 1.
Default: `1000` |

A value that breaks a rule stops TR Gateway at startup. Dropping rows never changes the day-count headlines.

```yaml
sequence-gaps:
  max-closed-per-direction: 20
  max-open-per-direction: 1000
  # closed-gap-retention-ms: 900000
  # hint-reset-tolerance-ms: 1000
  # history-enabled: true
  # history-flush-interval-ms: 1000
```


**Important**


If TR Gateway restarts between the `end-of-day-cleanup` time and the next `journal.rollover-time`, it replays the day without the reset and reopens the gaps that it had closed. To avoid this, set the end-of-day cleanup time equal to `journal.rollover-time`, and leave out `market-open` and `market-close`.



For how to search stored gaps, see [Search sequence gaps](https://docs.itrsgroup.com/docs/geneos/collection/tr-gateway/1.0.0/user-guide/tr-gateway/index.html#search-sequence-gaps).

## Activity

YAML key: `activity`

TR Gateway counts order and trade activity for each second. It sums the counts for each protocol, firm, connection, market segment and direction, and publishes them to the Trading Performance dataviews, the **Review Activity** command, and `GET /api/activity`. When the search store is on, it also keeps the counts in the store for the retention period (`search.retention-days`), and keeps the daily totals for `search.daily-retention-days`. SQF is not counted.

| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | `true` forces the counters on. Without the search store they run as a live ledger only. `false` turns them off. When unset, they follow `search.data-dir`. Turning them off, or having no search store, also removes **Search Orders** and **Search Trades**.
Default: unset |
| `queue-capacity` | int | Rows buffered between the sessions and the aggregator. When the queue overflows, TR Gateway drops rows and counts them in `queueDropped` on `GET /api/activity/live`. Must be ≥ 1.
Default: `65536` |
| `trading-day-start` | string (`HH:mm`) | Time at which today's running totals reset. It must be a whole minute. When unset, it follows the first channel's `journal.rollover-time` and `journal.rollover-timezone`.
Default: unset |
| `trading-day-zone` | string (zone ID) | Time zone of `trading-day-start`, for example `America/New_York`. If `trading-day-start` is set and this is unset, the zone is UTC.
Default: unset |
| `trade-source` | `auto`, `drop` or `session` | Where the `All` row of the **Trading Performance Summary** takes its trades from. `drop` counts each match once from the DROP feed. `session` counts the matches seen on the order-entry sessions. `auto` uses `drop` when `protocol-dialects` maps `drop` or a channel's `protocol` is DROP, otherwise `session`. The `tradeSource` headline shows the result.
Default: `auto` |
| `negotiated-deal-source` | `DROP` or `FIX-DC` | Which feed's negotiated deals the `All` row counts, once for each deal ID.
Default: `DROP` |
| `firm-pattern` | string (regex) | Regular expression with at least one capturing group, applied to an OUCH session ID. Group 1 is the firm. When unset, the whole session ID is the firm.
Default: unset |
| `review-max-rows` | int | Maximum rows in a **Review Activity** results view, from `1` to `86400`. TR Gateway refuses a larger review.
Default: `1000` |

```yaml
activity:
  enabled: true
  queue-capacity: 65536
  trading-day-start: "07:00"
  trading-day-zone: America/New_York
  trade-source: auto
  negotiated-deal-source: DROP
  firm-pattern: "^([A-Z]+)[0-9]*_"
  review-max-rows: 1000
```


**Important**


Set `trading-day-start` to a time outside trading hours. TR Gateway also uses this boundary to separate conversations by trading day, except OUCH and SQF conversations that have a [file group](#capture-group-pattern). A request sent just before the boundary and its reply sent just after it become two conversations. If you do not set it, TR Gateway logs one startup warning when the boundary falls back to 00:00 UTC.



The counters cover these families:

| Family | Firm | Connection |
| --- | --- | --- |
| FIX and FIX-DC | Counterparty CompID (see [Local CompID prefixes](#local-compid-prefixes)), otherwise the session display name | Session display name, with `:SubID` when `fix-sessions.subid-split` is on |
| OUCH | Group 1 of `firm-pattern`, otherwise the session ID. Only OUCH decoded by a dialect plugin is counted. | Session ID |
| DROP | The participant name from the DROP reference data, otherwise `Unknown` | The actor name from the DROP reference data, otherwise the ID |
| SQF | Not counted | Not counted |

TR Gateway publishes a second's counts after the session has not touched it for 2 seconds. A late message within the next 30 seconds updates the stored row. A message later than that starts a new count for that second. The stored row for that second then holds only the late part, so the stored counts for that second are incomplete.

## Reference

YAML key: `reference`

TR Gateway builds an order book directory from the DROP feed. It uses the directory to resolve the instrument of every protocol: the OUCH, SQF and DROP order book ID, FIX SecurityID, and FIX Symbol. The directory is held in memory only, and refills from the DROP journal or DROP file on a restart. One directory serves every channel and the `data-dir` file lane.

Use `reference.segments` to give market segments display names.

| Field | Type | Description |
| --- | --- | --- |
| `segments` | map of int to string | Maps a market segment ID to a display name. TR Gateway uses the names in the Trading Performance rows, **Review Activity**, `marketSegmentName` on `GET /api/activity`, and the `marketSegment` search column. An ID that is not listed shows as its number. The `segment` filter accepts the ID or the name. A name must not be blank, two IDs must not share a name, and a name must not be `Total`, `Unknown` or `Negotiated deals (trade reports)`. TR Gateway stops at startup if a name breaks these rules.
Default: empty |

```yaml
reference:
  segments:
    71: Regular Equity
    69: Cash Equity
    33: Negotiated Equity
```

TR Gateway stops at startup, and names `reference.segments`, when a key is not an integer, when two IDs have the same name, or when a name is `Total`, `Unknown` or `Negotiated deals (trade reports)`. Those names are reserved for Trading Performance rows.

An instrument that the directory does not know shows `Unknown` for the symbol and market segment, and TR Gateway never drops it. Activity counts have no display-time fallback. A message that TR Gateway counts before the DROP reference data has loaded stays on the `Unknown` row. This can happen after a restart that replays channels in parallel, or when `data-dir` reads a non-DROP file before the DROP file. If DROP is not configured or licensed, every segment is `Unknown`. TR Gateway logs a warning at startup when `reference.segments` is set and no channel, `protocol-dialects` entry or `data-dir` can deliver DROP.

## Error alerting

YAML key: `error-alerting`

Detects broker errors and rejects on the ingest path. Omit this block to leave the feature off. To turn it on with all defaults, write `error-alerting: {}` or `error-alerting:` with `enabled: true` beneath it. Set `enabled: false` to disable a present block.

| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | Enable broker error detection when this block is present.
Default: `true` |
| `recent-errors-capacity` | int | Newest-first ring size per protocol (must be ≥ 1).
Default: `200` |
| `unknown-code-severity` | `CRITICAL` \| `ERROR` \| `WARNING` \| `UNKNOWN` | Severity for a code with no catalog entry. Values are case-sensitive.
Default: `ERROR` |
| `fix-text-fallback` | boolean | Use a numeric FIX `Text(58)` as a fallback error code when no reject-reason tag is present.
Default: `false` |
| `max-brokers` | int | Per-protocol cap on distinct tracked brokers (must be ≥ 1). Overflow rolls into a shared `(other)` row.
Default: `500` |
| `catalogs` | list of `{dialect, path}` | External per-dialect catalog override directories, layered on the bundled catalog. Add a `fix` override to enrich FIX rejects. |

When Geneos instrumentation is enabled, TR Gateway publishes `<PROTO>-TradeErrors-Recent` and `<PROTO>-TradeErrors-Brokers` for each protocol that has recorded at least one error or reject.

## Schedules

YAML key: `schedules`

Defines operational hours and holiday calendars for in-schedule and staleness reporting. These windows do not control [end-of-day cleanup](#end-of-day-cleanup).

| Key | Description |
| --- | --- |
| `holiday-calendars` | Named calendars with `holidays` date lists (`YYYY-MM-DD`). |
| `operational-schedules` | Named windows with `timezone`, `start-time`, `end-time`, and optional `operational-days` and `holiday-calendar`. See [Operational schedule fields](#operational-schedule-fields). |
| `session-schedules` | Map of session ID to schedule name. |
| `default-schedule` | Schedule used when a session is not mapped. |

### Operational schedule fields

YAML key: `schedules.operational-schedules.<name>`

| Field | Type | Description |
| --- | --- | --- |
| `timezone` | string | IANA time zone for `start-time` and `end-time`, for example `America/New_York`. A schedule with no `timezone` stops TR Gateway at startup with `NullPointerException: zoneId`.
Mandatory: Yes |
| `start-time` | string | Start of the window (`HH:mm`).
Mandatory: Yes |
| `end-time` | string | End of the window (`HH:mm`). Must be after `start-time`, or TR Gateway stops at startup. Overnight windows that cross midnight are not supported.
Mandatory: Yes |
| `operational-days` | list of string | Days on which the window applies. Use the upper-case English names `MONDAY` to `SUNDAY`. Any other value stops TR Gateway at startup.
Default: Monday to Friday |
| `holiday-calendar` | string | Name of a calendar in `holiday-calendars`. The window does not apply on that calendar's holidays. An unknown name is ignored, so the window has no holidays and TR Gateway reports no error. |

## End-of-day cleanup

YAML key: `end-of-day-cleanup`

Resets daily KPIs, order state, and protocol trackers for every session at the configured time. Independent of [schedules](#schedules).

| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | Enable the daily reset.
Default: `true`. The reset is enabled by default, but nothing is reset unless `time` is set. |
| `timezone` | string | Time zone for the reset. Set this to the venue trading-day zone, for example `America/New_York`. If you omit it, the reset runs on UTC time, which can fire in the middle of a session.
Default: `UTC` |
| `time` | string | Reset time (`HH:mm`). Must be at or after `market-close` when a market window is set.
Default: none. No reset happens until you set it. |
| `market-open` / `market-close` | string | Optional trading window. Set both or neither. Validated as `market-open < market-close ≤ time`. |

Omit the block, or set `enabled: false`, to accumulate for the process lifetime.

## FIX connection

YAML key: `fix-connection`

Tunes how TR Gateway decides that a session is connected. The settings apply to sessions of every protocol, not only FIX. They drive the `Connected` column of the KPI views and `GET /api/sessions`. Recent inbound activity uses the negotiated `HeartBtInt` plus `heartbeat-overhead-ms`, or `activity-fallback-ms` when no heartbeat interval was negotiated.

| Field | Type | Description |
| --- | --- | --- |
| `heartbeat-overhead-ms` | long | Added to the negotiated `HeartBtInt` when detecting recent inbound activity.
Default: `30000` |
| `activity-fallback-ms` | long | Activity window when no heartbeat interval was negotiated.
Default: `60000` |

## Worked examples

### FIX (gRPC from the file streamer)

YAML key: FIX (no `protocol-dialects` entry)

```yaml
licensing:
  host: licd.example.com
  port: 7041

perspective: SELL_SIDE
local-comp-id-prefixes:
  - "LOCAL"
  - "VENUE"

instrumentation:
  geneos:
    enabled: true
    listen-port: 7035
    probe-name: TRGatewayProbe
    managed-entity: tr-gateway
    sampler-name: TRGateway
    search-commands:
      enabled: true

channels:
  ca-grpc:
    type: streaming
    protocol: fix
    grpc-port: 9500
    payload-encoding: base64
    journal:
      directory: ./data/journals/fix
      rollover-time: "07:00"
      rollover-timezone: "America/New_York"
      retention-days: 5
      retention-enabled: true

search:
  data-dir: data/search
  retention-days: 30

status-server:
  enabled: true
  bind-address: 127.0.0.1
  port: 8080
```

FIX needs no `protocol-dialects` entry. Set `local-comp-id-prefixes` to your local CompIDs.

### OUCH

YAML key: `protocol-dialects.ouch`

```yaml
licensing:
  host: licd.example.com
  port: 7041

protocol-dialects:
  ouch: ${env:TRG_OUCH_DIALECT}

channels:
  ouch:
    type: streaming
    protocol: ouch
    grpc-port: 9501
    payload-encoding: base64
    journal:
      directory: ./data/journals/ouch
      rollover-time: "07:00"
      rollover-timezone: "America/New_York"
      retention-days: 5

search:
  data-dir: data/search

status-server:
  enabled: true
  bind-address: 127.0.0.1
  port: 8080
```

Set `TRG_OUCH_DIALECT` before you start. An unset variable stops TR Gateway with `protocol-dialects: no plugin found for dialect ''`. See [Protocol dialects](#protocol-dialects).

### SQF

YAML key: `protocol-dialects.sqf`

```yaml
licensing:
  host: licd.example.com
  port: 7041

protocol-dialects:
  sqf: ${env:TRG_SQF_DIALECT}

channels:
  sqf:
    type: streaming
    protocol: sqf
    grpc-port: 9502
    payload-encoding: base64
    journal:
      directory: ./data/journals/sqf
      rollover-time: "07:00"
      rollover-timezone: "America/New_York"
      retention-days: 5

search:
  data-dir: data/search

status-server:
  enabled: true
  bind-address: 127.0.0.1
  port: 8080
```

Set `TRG_SQF_DIALECT` before you start. An unset variable stops TR Gateway with `protocol-dialects: no plugin found for dialect ''`. See [Protocol dialects](#protocol-dialects).

### Complete configuration

The following example shows a full streaming-only file with licensing, Geneos instrumentation, Status/Search UI, search, storage, error alerting, schedules, end-of-day cleanup, and FIX/OUCH/SQF/DROP channels from the file streamer. Replace hosts, CompIDs, session ids, dialects, ports, and timezones for your environment. Use [environment-variable substitution](#credential-handling) for credentials. An unset `TRG_OUCH_DIALECT`, `TRG_SQF_DIALECT`, or `TRG_DROP_DIALECT` stops TR Gateway with `protocol-dialects: no plugin found for dialect ''`. See [Protocol dialects](#protocol-dialects).

```yaml
# Trading Session Gateway configuration.

# Licence Daemon (licd) connection.
licensing:
  host: ${env:TRG_LICD_HOST:licd.example.com}
  port: 7041
  # tls: true
  # tls-config:
  #   trust-chain-file: ${env:LICD_TRUST_CHAIN:/certs/licd-ca.pem}

perspective: SELL_SIDE

# Required for real FIX channels — without a streamer direction, an empty list infers direction from the message type.
local-comp-id-prefixes:
  - "LOCAL"
  - "VENUE"

# Map each non-FIX family you stream to the dialect that matches the wire format.
protocol-dialects:
  ouch: ${env:TRG_OUCH_DIALECT}
  sqf: ${env:TRG_SQF_DIALECT}
  drop: ${env:TRG_DROP_DIALECT}

rate-window-seconds: 60
staleness-threshold-ms: 30000

instrumentation:
  geneos:
    enabled: true
    listen-port: 7035
    probe-name: TRGatewayProbe
    managed-entity: tr-gateway
    sampler-name: TRGateway
    self-monitoring-interval-ms: 10000
    domain-interval-ms: 5000
    jvm-metrics: true
    search-commands:
      enabled: true
      results-dataview-name: Search-Results
      max-result-views: 5
      query-timeout-ms: 10000
      default-lookback-minutes: 30
    # TLS for the probe listen socket. Omit tls-config (or omit cert-file) for plaintext.
    #tls-config:
    #  cert-file: ${env:TRG_CERT:/certs/tr-gateway.crt}
    #  key-file: ${env:TRG_KEY:/certs/tr-gateway-key.pem}
    #  # trust-chain-file: ${env:TRG_TRUST_CHAIN:/certs/rootCA.pem}
    #  # require-client-auth: true
    #  min-tls-version: "1.3"

status-server:
  enabled: true
  bind-address: 127.0.0.1
  port: 8080

# Message search — active when data-dir is set. Do not set console-port in production.
search:
  data-dir: data/search
  retention-days: 30
  retention-time: "01:00"
  retention-zone: "UTC"
  wal-apply-interval-ms: 1000

storage:
  correlation-ttl-seconds: 60
  correlation-sweep-interval: 1024
  correlation-idle-ttl-seconds: 86400
  exec-id-capacity: 50000
  latency-threshold-ms: 100
  latency-short-window-seconds: 10
  latency-long-window-seconds: 300
  latency-cap-seconds: 60

fix-connection:
  heartbeat-overhead-ms: 30000
  activity-fallback-ms: 60000

# Opt-in: omit this block entirely to disable TradeErrors.
error-alerting:
  enabled: true
  recent-errors-capacity: 200
  unknown-code-severity: ERROR
  fix-text-fallback: false
  max-brokers: 500
  #catalogs:
  #  - { dialect: "fix", path: "/etc/tr-gateway/catalogs/fix" }

# Streaming-only: no top-level data-dir. One gRPC channel per protocol family.
channels:
  fix:
    type: streaming
    protocol: fix
    grpc-port: 9500
    payload-encoding: base64
    journal:
      directory: ./data/journals/fix
      rollover-time: "07:00"
      rollover-timezone: "America/New_York"
      retention-days: 5
      retention-enabled: true

  ouch:
    type: streaming
    protocol: ouch
    grpc-port: 9501
    payload-encoding: base64
    journal:
      directory: ./data/journals/ouch
      rollover-time: "07:00"
      rollover-timezone: "America/New_York"
      retention-days: 5
      retention-enabled: true

  sqf:
    type: streaming
    protocol: sqf
    grpc-port: 9502
    payload-encoding: base64
    journal:
      directory: ./data/journals/sqf
      rollover-time: "07:00"
      rollover-timezone: "America/New_York"
      retention-days: 5
      retention-enabled: true

  drop:
    type: streaming
    protocol: drop
    grpc-port: 9503
    payload-encoding: base64
    default-drop-session-id: DROP
    journal:
      directory: ./data/journals/drop
      rollover-time: "07:00"
      rollover-timezone: "America/New_York"
      retention-days: 5
      retention-enabled: true

# Global daily KPI and order-state reset. market-open and market-close are optional.
# When set, they are validated as market-open < market-close ≤ time, so the reset cannot fire during the session.
end-of-day-cleanup:
  enabled: true
  timezone: "America/New_York"
  time: "07:00"

# Schedules drive in-schedule / staleness reporting only (not EOD cleanup).
schedules:
  holiday-calendars:
    venue-holidays:
      holidays:
        - "2026-01-01"
        - "2026-07-04"
        - "2026-12-25"

  operational-schedules:
    venue-session:
      timezone: "America/New_York"
      start-time: "09:00"
      end-time: "16:00"
      operational-days: ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY"]

    default:
      timezone: "UTC"
      start-time: "00:00"
      end-time: "23:59"

  default-schedule: "default"
```


**Important**


Adjust `protocol-dialects` when the file streamer delivers a different wire format, and take the dialect values from your ITRS account manager. Map only the families you license and stream. See [Protocol dialects](#protocol-dialects).




