logstash-plugins / logstash-filter-date

Apache License 2.0
7 stars 43 forks source link

Match parameter field name of date filter doesn't support variable interpolation #91

Open hartfordfive opened 7 years ago

hartfordfive commented 7 years ago

It seems that the date filter's first argument of the match parameter does not support interpolation.

I've had a use case where I've dynamically set the name of the field containing the date/time within the [@metadata][time_field] attribute (to the value timestamp in my case) but unfortunately I've had to revert back to using a simple string.

Logstash Installation details:

This was attempted, and didn't work:

      date {
        match => ["[@metadata][time_field]",  "yyyy/mm/dd HH:mm:ss", "dd/MMM/yyyy:HH:mm:ss Z", "UNIX", "UNIX_MS"]
        locale => "en"
        add_tag => [ "timestamp_updated" ]
        timezone => "Etc/UTC"
        tag_on_failure => ["_dpf"]
      }

Therefore modifying the field needed to be changed to a simple string:

      date {
        match => ["timestamp",  "yyyy/mm/dd HH:mm:ss", "dd/MMM/yyyy:HH:mm:ss Z", "UNIX", "UNIX_MS"]
        locale => "en"
        add_tag => [ "timestamp_updated" ]
        timezone => "Etc/UTC"
        tag_on_failure => ["_dpf"]
      }