liveBook · Manning

Match block

As explained in Learn Docker in a Month of Lunches, Second Edition

A match block is a Fluentd configuration block that selects records by tag or pattern and specifies their processing or destination.

A match block tells Fluentd what to do with records whose tags fit a pattern. Use ordered matches to route verbose logs away from long-term storage while keeping other application logs in Elasticsearch. section 19.4

Listing 19.4 Sending log entries to different targets based on the tag
<match gallery.access-log.**>
  @type copy
  <store>
    @type stdout
  </store>
</match>
<match gallery.**>
  @type copy
  <store>
    @type elasticsearch
. . .

The configuration routes gallery.access-log records to stdout and other gallery records to Elasticsearch, using tag patterns and copy stores. section 19.4

A practical filtering workflow:

  • Tag records through the logging driver, then match the tag prefix in Fluentd. section 19.4
  • Send verbose access-log records to Fluentd stdout instead of Elasticsearch. section 19.4
  • Change the Fluentd configuration and redeploy it without changing application containers. section 19.4

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains tag-pattern matching, destination stores, and configuration redeployment without detailing Fluentd internals.
Examples
Uses gallery.access-log.** and gallery.** patterns to separate access logs from other application logs.
What it assumes
Assumes familiarity with Docker Compose, Fluentd configuration, logging-driver tags, and Elasticsearch destinations.
What you can do after
Operate/configure Fluentd to filter verbose records and redirect them without modifying application containers.
How it connects
Connects Fluentd tags with Docker logging, stdout, Elasticsearch, Kibana, and log enrichment.

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.