logs_processor

logs_processor #

Description #

Collect the local log files.

Configuration Example #

The elasticsearch log files as an example.

pipeline:
  - name: log_collect
    auto_start: true
    keep_running: true
    retry_delay_in_ms: 3000
    processor:
      - logs_processor:
          queue_name: "logs"
          logs_path: "/opt/es/elasticsearch-7.7.1/logs"
          # metadata for all log items
          metadata:
            category: elasticsearch
          patterns:
            - pattern: ".*_server.json$"
              type: json
              metadata:
                name: server
              timestamp_fields: ["timestamp", "@timestamp"]
              remove_fields:
                [
                  "type",
                  "cluster.name",
                  "cluster.uuid",
                  "node.name",
                  "node.id",
                  "timestamp",
                  "@timestamp",
                ]
            - pattern: "gc.log$"
              type: text
              metadata:
                name: gc
              timestamp_patterns:
                - "\\d{4}-\\d{1,2}-\\d{1,2}T\\d{1,2}:\\d{1,2}:\\d{1,2}.\\d{3}\\+\\d{4}"
                - "\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2},\\d{3}"
                - "\\d{4}-\\d{1,2}-\\d{1,2}T\\d{1,2}:\\d{1,2}:\\d{1,2},\\d{3}"
            - pattern: ".*.log$"
              type: multiline
              line_pattern: '^\['
              metadata:
                name: server
              timestamp_patterns:
                - "\\d{4}-\\d{1,2}-\\d{1,2}T\\d{1,2}:\\d{1,2}:\\d{1,2}.\\d{3}\\+\\d{4}"
                - "\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2},\\d{3}"
                - "\\d{4}-\\d{1,2}-\\d{1,2}T\\d{1,2}:\\d{1,2}:\\d{1,2},\\d{3}"

Parameter Description #

NameTypeDescription
queue_namestringLog files collection queue name
logs_pathstringLog files path
metadatamapConfigure the metadata for the log files
patternsobjectPatterns configuration for log files
patterns.patternstringPattern for log files
patterns.metadatamapConfigure the metadata for the log files which matched
patterns.typestringLog type, support jsontextmultiline
patterns.line_patternstringWhen the log type is multiline, the pattern for a new line
patterns.remove_fields[]stringFields that need to be removed (available when the log type is json)
patterns.timestamp_fields[]stringTimestamp field (available when the log type is json)
patterns.timestamp_patterns[]stringTimestamp pattern (available when the log type is text and multiline )
Edit Edit this page