<commit_before>vector:
  configuration:

    api:
      enabled: true

    log_schema:
      timestamp_key: "@timestamp"
      host_key: log_host

    sources:

      mongodb_log:
        type: file
        file_key: log_file
        include:
          - /var/log/mongodb/mongodb.log

    transforms:

      log_parser:
        inputs:
          - mongodb_log
        type: regex_parser
        drop_failed: true
        field: message
        overwrite_target: true
        patterns:
          - '^(?P<time>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}\+\d{4}) (?P<log_level>\w) (?P<component>\w+)\s+\[(?P<context>.+?)\] (?P<message>.*)'
        types:
          time: timestamp|%Y-%m-%dT%H:%M:%S%.3f%z

     field_adder:
        inputs:
          - log_parser
        type: add_fields
        fields:
          labels:
            - mongodb
          environment: {{ salt.grains.get('environment') }}

      timestamp_renamer:
        inputs:
          - field_adder
        type: rename_fields
        fields:
          time: "@timestamp"

    sinks:

      elasticsearch:
        inputs:
          - timestamp_renamer
        type: elasticsearch
        endpoint: 'http://operations-elasticsearch.query.consul:9200'
        index: logs-mongodb-%Y.%W
        healthcheck: false
<commit_msg>Fix bad indentation in pillar/vector/mongodb.sls<commit_after>vector:
  configuration:

    api:
      enabled: true

    log_schema:
      timestamp_key: "@timestamp"
      host_key: log_host

    sources:

      mongodb_log:
        type: file
        file_key: log_file
        include:
          - /var/log/mongodb/mongodb.log

    transforms:

      log_parser:
        inputs:
          - mongodb_log
        type: regex_parser
        drop_failed: true
        field: message
        overwrite_target: true
        patterns:
          - '^(?P<time>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}\+\d{4}) (?P<log_level>\w) (?P<component>\w+)\s+\[(?P<context>.+?)\] (?P<message>.*)'
        types:
          time: timestamp|%Y-%m-%dT%H:%M:%S%.3f%z

      field_adder:
        inputs:
          - log_parser
        type: add_fields
        fields:
          labels:
            - mongodb
          environment: {{ salt.grains.get('environment') }}

      timestamp_renamer:
        inputs:
          - field_adder
        type: rename_fields
        fields:
          time: "@timestamp"

    sinks:

      elasticsearch:
        inputs:
          - timestamp_renamer
        type: elasticsearch
        endpoint: 'http://operations-elasticsearch.query.consul:9200'
        index: logs-mongodb-%Y.%W
        healthcheck: false

{'fraction_non_alphanumeric': 0.1334097859327217, 'fraction_numerical': 0.009938837920489297, 'mean_word_length': 1.6951596292481976, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1748709', 'n_tokens_mistral': 882, 'n_tokens_neox': 835, 'n_words': 140}