Centralized Mattermost logging with Grafana Loki

Adding Loki and the OpenTelemetry Collector gives you one place to search Mattermost logs from every app server, filter by level and status, and line events up with metric spikes. This page covers the design choices, setup and limits to confirm.

On this page

Why Mattermost teams centralize logs with Grafana Loki

Centralizing Mattermost logs means one place to search every app server's output, so an investigation does not start with a login to each node. Grafana Loki stores and indexes log streams, and the OpenTelemetry Collector ships them there from each server while attaching labels such as host and log level. Together they let an operator filter by level or status across the whole cluster and place a burst of error lines on the same timeline as a metric spike from Prometheus in Grafana. Loki is licensed under AGPLv3, the Collector under Apache-2.0, and OpenTelemetry is a framework rather than a storage backend, so Loki (or another store) remains a separate component you must select, run and review.

The case becomes strong once a Mattermost deployment runs on several application servers behind a load balancer, where a single user's failed post may leave evidence on one node and a slow query on another. It also matters when compliance or security reviewers ask for log review across a retention window, and when on-call staff need to correlate a rise in error responses with a metric spike at the same minute. Single-node installations with light traffic may find local files and rotation sufficient. Before any shipping is configured, the team must set Mattermost's own logging: which console and file levels are active, whether the AdvancedLoggingJSON targets are defined, and how notification and audit logs are separated. Loki and the Collector only forward what the server emits, so noisy or inconsistent logging is carried into the central store unchanged.

How Mattermost logs flow from app servers to Grafana

The flow starts on each Mattermost app server, where a Collector agent (the OpenTelemetry Collector, or Grafana Alloy as its vendor-neutral distribution) reads the logs and forwards them either to a gateway or directly to Loki. Loki sits behind an authenticating reverse proxy, which is the trust boundary, and tenants are separated by the X-Scope-OrgID header on every request. Loki writes compressed chunks and its index to object storage, while Grafana queries Loki for logs and Prometheus for metrics side by side. Check that the proxy rejects unauthenticated requests and that each agent sets the tenant header correctly.

Log path from app servers through the Collector and proxy into Loki and Grafana.

Which Loki deployment mode and log shipper fit your cluster

This table compares the three Loki deployment modes and the common log shippers, with the volume ranges and status notes the Loki documentation gives. Read the mode rows first to size the Loki side, then the shipper rows to pick how each Mattermost node sends its logs.

OptionDocumented fit or roleWhen to choose it
Loki monolithic modeSingle binary, documented for up to about 20 GB of logs per day (Loki deployment modes docs)A single-site Mattermost with modest log volume, a lab, or a pilot before committing to a larger layout
Loki simple scalable modeSeparate read, write and backend targets, documented as approaching 1 TB per day (Loki deployment modes docs)Higher volume, but plan a migration: the Loki docs state this mode is being deprecated and will be removed with Loki 4.0
Loki microservices modeIndependently scaled components for very large clusters (Loki deployment modes docs)Very large log volumes where the team can run and tune many components; confirm the staffing needed before choosing it
Grafana AlloyGrafana's supported log shipper for Loki, and a vendor-neutral distribution of the OpenTelemetry Collector (Loki send data docs)Default choice when Grafana is already in the stack and one agent should handle logs, metrics and traces
OpenTelemetry CollectorVendor-agnostic receiver, processor and exporter pipeline; Loki ingests OpenTelemetry logs over HTTP (OpenTelemetry Collector docs)Teams standardizing on OpenTelemetry pipelines, or sending logs to more than one backend
PromtailLoki's original log shipper, documented in the Loki send data section (Loki: Promtail docs)Confirm its current status with Grafana before selecting it for a new build, since Alloy is the supported path
Fluent Bit or FluentdAccepted by Loki as log shippers (Loki send data docs)Existing log pipelines already built on these tools, or nodes where another agent is already running
Docker logging driverLoki accepts logs from the Docker logging driver (Loki send data docs)Mattermost running in containers with a small, single-purpose logging path; confirm how it handles log loss on restart in your setup

How to choose object storage, retention and tenancy

Loki keeps compressed log chunks and its index in object storage, so the storage choice sets durability, operating model and cost for the whole logging stack. Loki's recommended production stores are Amazon S3, Google Cloud Storage and Azure Blob Storage. S3-compatible services such as MinIO and the local filesystem are supported, but the Loki docs say they are not typically recommended for production. The trade-off is operational control against managed durability: an on-premises S3-compatible store keeps data inside your facility, but your team then owns its replication, capacity planning and recovery. A local filesystem is the simplest option for a lab and the weakest one for audit-relevant logs.

  • Managed cloud object storage: Recommended by Loki for production. Durability, replication and access logging come from the provider, and billing is usage-based.
  • S3-compatible on-premises stores: Keep data in your data center or air-gapped network. Your team owns redundancy, backups and capacity, and the store must be proven under Loki's write and query load.
  • Local filesystem: Acceptable for a proof of concept. It ties logs to one disk and is not typically recommended for production.
  • Cost drivers: Stored volume, request counts and cross-region or egress traffic. Ask the provider or your storage team for their pricing model before sizing.
  • Deployment mode: Monolithic mode suits small volumes, and larger volumes move to simple scalable mode. Confirm the mode against your daily log volume.

Confirm whether your security policy permits the chosen store's location and encryption model, and who holds the keys.

Set up Loki and the Collector for Mattermost logs

This sequence takes Mattermost log output from each app server into a Loki store that your team can query by node, level and status, with access controlled at the proxy and retention set on purpose. Each step ends with a check so you know the stage is complete before the next one starts.

  1. Confirm Mattermost log output and format

    Before any collector work, your platform engineers confirm where each Mattermost server writes its logs, which level is set for console and file output, and whether entries are emitted as JSON. Review the server logging settings on every app server, not only the first one, because nodes can drift. The check is a sample of recent log lines from each node that shows timestamp, level and message fields in a consistent format. If the format differs between nodes, fix the configuration before continuing, since the parsing rules in the collector depend on it.

  2. Deploy Loki in the chosen mode

    Choose a Loki deployment mode based on expected log volume, using the sizing guidance in Grafana's Loki deployment modes documentation. Configure the TSDB index and point chunk and index storage at an object store your organization approves, such as Amazon S3, Google Cloud Storage, Azure Blob Storage or a production-grade S3-compatible service. Avoid the local filesystem for production. Note that simple scalable mode is being deprecated, so confirm your choice against the current documentation. The check is that Loki reports ready and a test push from one node lands in object storage.

  3. Place an authenticating reverse proxy in front of Loki

    Loki has no built-in authentication layer, so your team places an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. Enable multi-tenancy with auth_enabled if you need tenant separation, and have the proxy set the X-Scope-OrgID header for each request. Restrict direct access to the Loki ports at the network level. The check is that an unauthenticated request to the push and query endpoints is refused, and an authenticated request with the correct tenant header succeeds.

  4. Install the Collector on each app server

    Install the OpenTelemetry Collector on every Mattermost app server, preferably from the contrib distribution your organization has reviewed and pinned to a version. Configure a filelog receiver that reads the Mattermost log files, parses the level and timestamp fields, and adds a node identifier. Export to Loki through an OTLP or Loki exporter, using TLS and the credentials your proxy requires. Restrict collector configuration file permissions because the exporter configuration may hold credentials. The check is that the collector service runs on each node and its own logs show successful exports without repeated retries.

  5. Set labels to keep cardinality low

    Limit Loki stream labels to a small, stable set such as the environment, the node name, the service and the log level. Keep user IDs, channel IDs, request IDs and message text out of labels and leave them in the log line, where LogQL can filter them after ingestion. High-cardinality labels create many small streams and slow queries. Review the collector's resource and attribute processors so that no free-form field is promoted to a label. The check is that the label list on a sample stream shows only the agreed keys and the number of active streams stays stable as traffic grows.

  6. Enable retention with the compactor

    Retention in Loki is disabled by default, so logs are kept indefinitely until your team sets retention_enabled and defines the period in the compactor configuration. Decide the retention period with your compliance and security owners before enabling it, and choose whether it applies globally, per tenant or per stream selector. Each stream rule must be at least 24 hours. The check is that the compactor logs show retention running and that a test stream older than the configured period is removed from the store on the next pass.

  7. Verify with per-node queries and a level filter

    Run a LogQL query for each Mattermost node to confirm that every app server appears in Grafana Explore with recent entries. Then filter by level, for example to show only error entries, and filter on a known status or request path to confirm that structured fields parse correctly. Compare the result counts with the log files on the node for the same time window. The check is that each node returns entries, the level filter returns only the expected levels, and a deliberate test error from a non-production server appears in the results within the window you expected.

Which Collector components and labels keep queries usable

The OpenTelemetry Collector moves Mattermost log events through three kinds of components: receivers that read logs in, processors that transform them, and exporters that send them to Loki. Extensions sit beside that pipeline and handle concerns such as authentication, so a receiver can require OIDC from callers and an exporter can attach credentials to its outgoing requests with the oauth2client extension. Map each pipeline to a single job: read the Mattermost log file on each app server, parse the JSON fields, drop or redact what must not be stored, then export to a Loki endpoint behind your authenticating reverse proxy. Keep the processing stage small. Every transform you add runs on every log line from every node, and a fault in one processor can stop the whole pipeline.

Decide early which fields become Loki labels and which stay in the log line. Labels such as the cluster name, the node or pod, the environment and the log level are useful for narrowing a query before Loki scans chunks. Fields with many distinct values, such as user IDs, channel IDs, request IDs or full URLs, belong in the JSON body, where you filter them with LogQL line and JSON parsing. Each unique combination of label values creates a separate stream, so high-cardinality labels produce huge numbers of small streams that slow ingestion and queries and grow the index. Confirm the label set with a short test on one node before you roll the pipeline out to every app server, and check the label count in Loki after the first day of ingest.

Check stability before you build on any component. The OpenTelemetry status page notes that core Collector components have mixed stability levels, and each component's README states its own level, so a receiver or processor you need may be beta or alpha. Pin the Collector version you test, prefer the signed contrib release artifacts with their SHA256 checksums and SBOM files, and record which components your configuration uses. Follow the Collector configuration best practices for the security settings you must review, including exposed endpoints and credentials. Ask your implementation team to show the README stability level for every component in the final configuration, and plan a retest of the pipeline after each Collector upgrade.

Securing the logging path and the log data

A central log store collects everything the Mattermost servers write, including user and message context, so it becomes a sensitive system in its own right. The controls below cover who can reach Loki, how tenants and data are separated, how traffic is protected, and how the components stay patched.

Put an authenticating proxy in front of Loki

Loki has no built-in authentication layer, so the documentation requires an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. Without one, anyone who can reach the Loki port can query or push logs. Plan the proxy as a required component, put it behind your identity provider, and test that unauthenticated requests to the push and query endpoints are rejected.

Loki authentication docs

Authenticate collector connections

Collector authenticator extensions can check credentials on incoming receiver connections, for example with OIDC, and attach credentials to outgoing exporter requests, for example with the oauth2client extension. Decide which agents push logs, how each one obtains its identity, and where credentials are stored. Keep the configuration file's secrets out of version control and confirm the chosen extension's stability level in its README before relying on it.

Plan access to sensitive log content

Application logs can include user identifiers, channel or team names and error payloads that reflect message content, depending on the log level in use. Decide which roles may query raw logs, which may see only aggregated views, and how long logs are kept. Review the Mattermost logging configuration against your privacy requirements and filter or redact fields in the Collector before data reaches Loki.

Separate tenants with X-Scope-OrgID

Loki is multi-tenant when auth_enabled is set to true, and each request identifies its tenant with the X-Scope-OrgID header. Tenant separation only holds if the proxy sets or validates this header, because a client that can choose any value can read another tenant's streams. Map each tenant to a team or environment, and test that a user from one tenant cannot query another tenant's data through Grafana.

Loki multi-tenancy docs

Encrypt traffic between agents and Loki

Logs travel from each Mattermost node through the Collector to Loki, and from Grafana back to Loki on every query. Terminate TLS at the proxy or the Loki endpoint, use certificates your internal authority issues, and confirm each exporter is configured to verify them. Check that the object store connection and the Grafana data source connection are encrypted as well, since these carry the same data.

Patch Loki, the Collector and Grafana

Each component has its own release cadence, so one upgrade plan must cover all three. Loki v3.7.8 was published on September 17, 2026, the OpenTelemetry Collector v0.163.0 on October 16, 2026, and Grafana publishes patch releases at least monthly. Assign an owner for each component, subscribe to release notices, and test upgrades in a staging stack before applying them to the production log path.

Grafana upgrade guidance

What teams ask before adding centralized logging

How much effort does a centralized Mattermost logging build take?

The effort depends mostly on how many app servers you run, how much log volume they produce, which object storage you use, how your identity provider is wired in, and how strict your retention rules are. A single-node test stack is a small job. A multi-node cluster with separate read and write paths, S3-compatible storage, a reverse proxy for authentication, tenant headers and audited retention is a larger one. Loki's own documentation sizes deployment modes by daily volume, with monolithic mode suited to smaller volumes and simple scalable mode for larger ones, so volume is the first number to measure. Ask any partner to size the work from your node count, measured log volume and retention targets in a written scope, then quote from that scope.

Can our own team build this without outside help?

Yes, if your team already runs Linux services, object storage and a reverse proxy, and has someone who can own the Grafana and Loki configuration over time. The build touches several systems at once: Mattermost log output, the OpenTelemetry Collector or Grafana Alloy shipper on each node, Loki with its compactor and retention settings, Grafana, and the authenticating proxy in front of Loki. Teams without that mix usually find the hard part is not the first working query but the access model, retention sign-off and upgrade handling. A partner can take on any part of that work, or review your design, under a fixed scope agreed in writing before work starts.

What do we need to provide before the work starts?

Expect to provide access to the environment where Mattermost runs, including each app server and the place where Loki and Grafana will be hosted. You will also need an object store for Loki chunks and index, such as Amazon S3, Google Cloud Storage, Azure Blob Storage or an S3-compatible service, and the identity provider that will sign users into Grafana. Most important is a named owner who signs off on retention periods, because Loki keeps logs indefinitely until retention is enabled. Confirm with your security and compliance teams which log events they must keep, for how long, and who may read them before configuration begins.

Does Loki need its own login, or does Grafana handle access?

Loki has no built-in authentication layer, so Grafana access control alone does not protect the Loki API. The Loki documentation says to place an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. If auth_enabled is true, Loki also separates data by tenant using the X-Scope-OrgID header on each request, so the proxy and Grafana data source must set that header consistently. Decide early whether one tenant serves all Mattermost nodes or whether environments such as production and test need separate tenants, because changing this later complicates queries and retention.

How does centralized logging relate to Mattermost's logging configuration and Prometheus?

Mattermost's logging configuration decides what the server writes: console and file levels, JSON output and audit or notification logs. Centralized logging only ships and indexes what that configuration produces, so a poor log format or missing fields will limit what you can search. Prometheus and Grafana cover numeric signals such as request rates and error counts from the metrics endpoint. Loki stores the event text behind those numbers. The useful pattern is to see a metric spike in Grafana and then open the log lines from the same time window to find the cause. Plan the log fields, labels and metric names together so the two data sources line up by time, node and status.

What does ongoing upkeep of a Loki logging stack involve?

Upkeep is recurring work. Loki, Grafana and the OpenTelemetry Collector each publish regular releases, so someone must track versions and test upgrades in a non-production environment first. Loki's retention is applied by the compactor, so retention rules need periodic review as compliance requirements change, and object storage growth needs watching. The Collector components have mixed stability levels, so check each pipeline component's stability before relying on it. Access reviews for Grafana users and proxy rules, certificate renewal and backup of Grafana configuration also recur. Ask any partner whether this support is included in the build or offered as a separate retainer, and get that split in the written scope.

Is our Loki license a problem for an internal logging platform?

Loki is licensed under AGPLv3, which Grafana Labs adopted on April 20, 2021 when it moved Loki from Apache License 2.0. Running Loki internally for your own staff is a different situation from offering it to outside users over a network, so the obligations depend on how you use it and whether you modify it. Grafana Enterprise is offered as a non-AGPL commercial option. The OpenTelemetry Collector uses Apache-2.0. Have your legal or licensing team review the Loki and Grafana license terms against your planned use before the build starts, and record the decision in the project scope.

Limits to confirm in your environment

Several choices in a Loki build depend on facts that change between releases and editions: the Loki deployment mode, the Grafana tier, the license and the Collector components. Confirm each one against your volume, your authentication requirements and your legal review before you commit to a design.

Loki version and deployment mode

Pick the Loki release and mode from your expected daily log volume, not from the default install. Monolithic mode is documented for up to about 20 GB of logs per day, and simple scalable mode is documented as approaching 1 TB per day. Confirm the volume estimate from your Mattermost server logs over a representative week, then check the current Loki releases page for the version you will pin.

Loki deployment modes

Simple scalable deprecation

The Loki documentation states that simple scalable mode is being deprecated and will be removed with Loki 4.0. If your volume points to that mode, decide now whether you accept a future migration to microservices or a different topology. Ask your Loki vendor or partner for the current deprecation timeline and the supported migration path before you write the runbook.

Grafana high availability and alerting

Grafana high availability needs two or more active-active servers behind a load balancer sharing a MySQL or PostgreSQL database. The docs say alerting needs extra configuration to avoid duplicate notifications, and Grafana Live has limitations in this mode. Confirm whether your Mattermost alert channel must survive a node failure, and test duplicate notifications before you rely on the dashboards for paging.

Grafana high availability docs

AGPLv3 license review

Loki and Grafana are licensed under AGPLv3, which Grafana Labs adopted on April 20, 2021. Whether that matters depends on whether you modify these components and make them reachable by outside users, so have your legal and compliance team review the obligations. Grafana Enterprise is offered as a non-AGPL commercial option, and that choice should be made in writing before the design is final.

Grafana licensing

Grafana authentication by edition

All Grafana editions support LDAP, generic OAuth, Entra ID, Okta, GitHub, GitLab, Google OAuth, auth proxy and JWT. SAML, team sync, active sync and SCIM provisioning are available only in Grafana Enterprise and Grafana Cloud. If your security team requires SAML sign-in or SCIM deprovisioning for log viewers, confirm that requirement before choosing the edition.

Grafana authentication docs

Collector component stability

The OpenTelemetry Collector is Apache-2.0 licensed and ships a contrib distribution, but core components have mixed stability levels documented in each component's README. Check the stability of every receiver, processor and exporter in your pipeline, including the log receivers you plan to use for Mattermost files. Pin the Collector release you test, and confirm which distribution your build includes.

OpenTelemetry status

Where to verify the details before you build

Start with the version pins before you copy any configuration. Loki, the OpenTelemetry Collector and Grafana all ship on their own release cadences, and the settings this topic depends on, including the auth_enabled flag, the X-Scope-OrgID tenant header, the retention settings and the Collector receiver and exporter blocks, can change between releases. The Loki releases on GitHub page lists the current Loki release and its publication date, and the OpenTelemetry Collector releases page shows the contrib distribution and its checksums and SBOM files. Record the exact versions you test against in your build notes, and confirm which one your security team has approved for the environment.

Next, read the deployment mode and log shipper pages against your own volume. The Loki deployment modes documentation explains when the monolithic, simple scalable and microservices modes fit, and notes that simple scalable mode is being deprecated, which matters for any design you expect to keep past the next major release. The Loki: send data page describes how Grafana Alloy, the OpenTelemetry route and other shippers reach Loki, so confirm which shipper your team will operate before you write any pipeline.

Finally, check the Grafana and Loki operations docs for the controls you will own. The Loki authentication page confirms that Loki has no built-in login layer, so the reverse proxy in front of it is part of your access design. The Grafana docs: Configure authentication page lists which identity options each Grafana edition supports, which decides whether your SSO plan works without an Enterprise license. Ask your vendor or your own licensing contact to confirm current edition and license terms for these components before you commit to a design.

How DeployOpen scopes and delivers Mattermost log centralization

DeployOpen plans, builds and hands over the Loki and OpenTelemetry Collector pipeline for Mattermost in infrastructure you control. The work starts with a written scope that covers which app servers, logs and access rules are in play, so your security and operations teams review the design before anything is deployed.

How we scope

  • We inventory every Mattermost app server and list which log sources each one writes to.
  • The written scope names the Loki deployment mode, object storage target, retention rules and tenant layout for your environment.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work begins.

How we build

  • We configure OpenTelemetry Collector agents on each app server and a gateway for central routing and processing.
  • We set up an authenticating reverse proxy in front of Loki, because Loki has no built-in authentication layer.
  • We connect Grafana to Loki, build level and status filters, and test that log events line up with metric spikes.

How we hand over

  • You receive configuration as code, a runbook for the pipeline and a record of the tests that were run.
  • We document retention settings, including that Loki keeps logs indefinitely until retention is enabled, and how to change them.
  • Your team walks through search, filtering and alert workflows with us before the handover is closed.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Retainers can cover Loki and Collector version upgrades, reviewed against the release notes before rollout.
  • Confirm during scoping which support hours, response paths and upgrade windows your organization requires.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.