4. Monitoring, Logging and Statistics

lokiExchangeStore

Version

Sends exchanges to a Grafana Loki instance, where they can be searched and visualized using LogQL and Grafana. Each exchange becomes one log line containing the exchange (including headers and bodies) as JSON, so it can be unpacked in LogQL using the | json stage. Log lines are labelled with job and with api, the name of the API the exchange passed through.

Exchanges are batched and pushed to /loki/api/v1/push every updateIntervalMs milliseconds. Only completed and failed exchanges are pushed: Loki cannot update a log line that has already been written, so emitting one line per exchange means waiting until the exchange is done. Exchanges that never finish are never pushed.

This store is write-only. The Membrane admin console cannot browse exchanges held in Loki; use Grafana for that.

Example Configuration

components:
exchangeStore:
lokiExchangeStore:
url: http://localhost:3100
job: gateway-eu
components:
   exchangeStore:
     lokiExchangeStore:
       url: http://localhost:3100
       job: gateway-eu

Syntax

lokiExchangeStore:
'$ref': <string>
bodyExceedingMaxSizeStrategy: error
httpClientConfig: {}
job: <string>
maxBodySize: <number>
orgId: <string>
updateIntervalMs: <number>
url: <string>
lokiExchangeStore:
  '$ref': <string>
  bodyExceedingMaxSizeStrategy: error
  httpClientConfig: {}
  job: <string>
  maxBodySize: <number>
  orgId: <string>
  updateIntervalMs: <number>
  url: <string>

Attributes

NameRequiredDefaultDescriptionExamples
$reffalse-Reference a component defined under components.-
bodyExceedingMaxSizeStrategyfalseTRUNCATEThe strategy to use (TRUNCATE or ERROR) when a HTTP message body is larger than the maxBodySize.-
jobfalsemembraneValue of the job label attached to every log line. Use it to tell several Membrane instances apart in Grafana.gateway-eu
maxBodySizefalse100000--
orgIdfalse-Tenant to write to, sent as the X-Scope-OrgID header. Required when Loki runs with auth_enabled: true. Omit for a single-tenant Loki.team-a
updateIntervalMsfalse---
urlfalsehttp://localhost:3100Base URL of the Loki instance. Exchanges are pushed to <url>/loki/api/v1/push.https://logs-prod-012.grafana.net

Child Structure

ElementCardinalityDescription
httpClientConfig0..1Configuration of the HTTP client used to reach Loki. Use its child to supply the credentials of a hosted Loki such as Grafana Cloud.

Can be used in