logstash-plugins / logstash-filter-translate

Translate filter for Logstash
Apache License 2.0
21 stars 47 forks source link

Add support for paths in field #47

Closed renflo closed 6 years ago

renflo commented 7 years ago

I can't manage to make paths work when used in "field". Would it be possible to add support for this?

Example input:

{
  "@timestamp": "2017-06-08T15:56:00.009Z",
  "@version": "1",
  "data": {
    "foo": "bar"
    }
  }
}

Expected output:

{
  "@timestamp": "2017-06-08T15:56:00.009Z",
  "@version": "1",
  "data": {
    "foo": "bar"
    }
  },
  "type": "baz"
}

Filter I attempted to write but which I could not make to work:

    translate {
      dictionary => [ "bar", "baz"
          ]
      field => "[data][foo]"
      destination => "type"
    }
guyboertje commented 7 years ago

I think your filter should look like this:

    translate {
      dictionary => {
         "bar" => "baz"
      }
      field => "[data][foo]"
      destination => "type"
    }
guyboertje commented 6 years ago

Unconfirmed after alternative suggestion, closing.