Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

elasticsearch - Logstash add dynamic whitelist names based on a filed value

I have a simple Json file log which I need to pass it into elasticsearch. It contains a structure similar to this.

{
  "component_name": "abc",
  "abc": "this is abc",
  "component_action": "action"
}

While passing into elasticsearch, I need to whitelist column names based on the value of the "component_name" field. In the above example, as the component name is "abc", I need to whitelist only "abc" column. I tried to access the field value using [fieldname] syntax but it did not work

whitelist_names => [ "[component_name]" ]

Any help would be appreciated.

question from:https://stackoverflow.com/questions/65931219/logstash-add-dynamic-whitelist-names-based-on-a-filed-value

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to enable interpolation

whitelist_names => [ "%{component_name}" ]
interpolate => true

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...