Skip to content

Docker

docker

Params

dockerHost string -

The docker host url to use for docker commands.

containerFilter string -

A filter to apply to the containers when listing them. This can be used to limit the containers that Cruncher will interact with.

streams array -

The list of streams to use for the Cruncher instance. This can be used to limit the streams that Cruncher will interact with.


Values can be:

  • stdout - Standard output stream of the container.
  • stderr - Standard error stream of the container.
containerOverride object -

An object to override the container settings. This can be used to set the container name, image, and other settings.

  • messageFieldName - The field name to use for the message in the container logs. This is useful if the container logs are not in the default format.

Example:

containerOverride:
messageFieldName: 'message'
logPatterns array -

A list of log patterns to use for the Cruncher instance. This can be used to limit the logs that Cruncher will interact with.


Each field should be of the form:

- name: <pattern_name>
pattern: <pattern_value>
applyTo: [container]
exclude: [container]
applyToAll: false
messageFieldName: <field_name>

  • name - The name of the pattern.
  • pattern - The regex pattern to use for the logs.
  • applyTo - The list of containers to apply the pattern to. This can be used to limit the containers that Cruncher will interact with.
  • exclude - The list of containers to exclude from the pattern. This can be used to limit the containers that Cruncher will not interact with.
  • applyToAll - If true, the pattern will be applied to all containers. If false, the pattern will only be applied to the containers specified in the applyTo field.
  • messageFieldName - The field name to use for the message in the logs. This is useful if the logs are not in the default format.

Examples

Minimal Configuration

cruncher.config.yaml
profiles:
default:
connectors: [docker]
connectors:
- name: docker
type: docker
params: {}

Config with log patterns

cruncher.config.yaml
profiles:
default:
connectors: [docker]
connectors:
- name: docker
type: docker
params:
containerOverride:
containerA: # lets say containerA has json logs
messageFieldName: raw_message # this is the field that contains the message
logPatterns:
- name: custom_pattern
pattern: "^(?P<timestamp>[^ ]+) (?P<level>[^ ]+) (?P<custom_message>.*)$"
applyToAll: true # apply this pattern to all containers
exclude:
- containerA # exclude containerA from this pattern
messageFieldName: custom_message