logstash-plugins / logstash-filter-translate

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

Feature Request: Translate Multiple Fields #79

Open Grunticus03 opened 5 years ago

Grunticus03 commented 5 years ago

Condensation of field and destination configuration options to a single configuration option as a hash, allowing multiple lookups and writes to separate fields where all other config options are the same.
Edit: This would not only reduce the complexity of the pipeline but also reduce the number of dictionary files that would need to be maintained by allowing merging of multiple smaller dictionary files with disparate terms.

For example, if I have three separate fields that contain the same value types to translate, I have to write out:

  translate {
    id => "Field1 Translate"
    dictionary_path => "/dictionaries/codes.yaml"
    field => "Field1"
    destination => "Field1Translate"
    refresh_behaviour => "replace"
  }
  translate {
    id => "Field2 Translate"
    dictionary_path => "/dictionaries/codes.yaml"
    field => "Field2"
    destination => "Field2Translate"
    refresh_behaviour => "replace"
  }
  translate {
    id => "Field3 Translate"
    dictionary_path => "/dictionaries/codes.yaml"
    field => "Field3"
    destination => "Field3Translate"
    refresh_behaviour => "replace"
  }

By converting the two options into a single hash type, it can be condensed down and would look like the following:

  translate {
    id => "Field Translate"
    dictionary_path => "/dictionaries/codes.yaml"
    translate => { 
      "Field1", "Field1Translate",
      "Field2", "Field2Translate",
      "Field3", "Field3Translate"
    }   
    refresh_behaviour => "replace"
  }
schmandforke commented 4 years ago

+1

chenyuheng commented 2 years ago

+1