Global fields not working

(Alberto Gonzalez) #1

I am using this sample on filebeat.yml to set global fields for all prospectors but is not working, i just see on my docs local fields but not this global fields. I am using fb 5.0-beta1

  fields_under_root: true
      instance_id: i-33458498
      region: us-east-1

(Andrew Kroh) #2

Your configuration is wrong for 5.x (it's not supposed to be nested under shipper). See the example here or in the included /etc/filebeat/filebeat.full.yml.

(Alberto Gonzalez) #3

Thanks! not nesting under shipper worked.

      instance_id: i-33458498
      region: us-east-1

is not possible to use ignore_older as global option also for all prospectors instead of repeting it 41 times in all my prospectors?

I want that first time filebeat is started to not send all the older logs, just new logs or logs since 1h ago.

(Andrew Kroh) #4

No, that's not a global config option.

If you don't want to duplicate the actual value you can use a reference variable. But you still have to reference it in each prospector.

fb.global_ignore_older: 1h

- paths:
    - /var/log/messages
  ignore_older: ${fb.global_ignore_older}

(Alberto Gonzalez) #5

Thanks!! is there any other way to avoid filebeat sending old logs when starting for first time or deleting registry? or is this the only property i have to set?

(Andrew Kroh) #6

This is the only config setting to influence that behavior. It looks at the modified time of the file. If it's within the ignore_older period then the file is harvested from the start (which could include log lines older than that period).

If you want to filter individual log lines by timestamp then you should add Logstash into the mix. Within Logstash you can then parse the timestamps from the log line then apply a ruby filter that does timestamp math and drops older log lines.

(Alberto Gonzalez) #7

Thanks, also all my logs have same multine pattern is it possible to specify something global instead of reapeating 41 times:

pattern: "^[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}"
negate: true
match: after

(Andrew Kroh) #8

You can use a reference variable again. For example:

  pattern: '\$\$\$'
  negate:  false
  match:   before

  - input_type: log
      - input.txt
    multiline: ${fb.multiline_log4j}

(Alberto Gonzalez) #9

Thanks, that worked fine!

(system) #10

This topic was automatically closed after 21 days. New replies are no longer allowed.