logstash check if field exists

前端 未结 4 799
清酒与你
清酒与你 2020-12-13 08:27

I have log files coming in to an ELK stack. I want to copy a field (foo) in order to perform various mutations on it, However the field (foo) isn\'t always present.

4条回答
  •  盖世英雄少女心
    2020-12-13 09:13

    To check if field foo exists:

    1) For numeric type fields use:

     if ([foo]) {
        ...
     }
    

    2) For types other than numeric like boolean, string use:

    if ("" in [foo]) {
        ...
    }
    

提交回复
热议问题