Skip to content

Match

Extract launch arguments from from text files/stdin using regular expressions.

Match configurations enable capturing launch arguments from files in any arbitrary format (e.g., xml, ini) to enable the 10x Engine to share configuration values with other processes it may be deployed with on the same container (e.g., log forwarders).

YAML Config

The following Filebeat match configuration parses the filebeatConfigPath and filebeatLogsPath arguments from the 10x Engine process' stdin device.

# 'match' parses a file or stdin stream for config vars using a regex pattern.
#  matched capture groups are accessible as 10x startup arguments.
- source: match
  options:

  # 'path' specifies the file path/stdin device from which to parse information
  path: stdin

  # Capture Filebeat's config and log path values from stdin as respective
  # 'filebeatConfigPath' and 'filebeatLogsPath' arguments using regex named capture groups
  regex: Config path:\s*\[(?<filebeatConfigPath>[^\]]*)\].*?Logs path:\s*\[(?<filebeatLogsPath>[^\]]*)\]

  # Max lines to read from stdin if no match for 'regex'
  maxLines: 20

JSON Config

The same @match macro can be passed as an escaped JSON directly as a CLI argument:

$ tenx @apps/dev @match={\"path\":\"stdin\",\"regex\":\"Config path:\\\\s*\\\\[(?<filebeatConfigPath>[^\\\\]]*)\\\\].*?Logs path:\\\\s*\\\\[(?<filebeatLogsPath>[^\\\\]]*)\\\\]\",\"maxLines\":20}