Generating filebeat custom fields

In your filebeat.yml:

filebeat:
  prospectors:
    -
      paths:
        - /path/to/my/folder
      input_type: log

      # Optional additional fields. These field can be freely picked
      # to add additional information to the crawled log files
      fields:
        mycustomvar: production

in filebeat-7.2.0 i use next syntax:

processors:
- add_fields:
    target: ''
    fields:
      mycustomfieldname: customfieldvalue

note: target = '' means that mycustomfieldname is a top-level field official 7.2 docs


Yes, you can add fields to the document through filebeats.

The official doc shows you how.