logstash(7)表达式

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sz85850597/article/details/86547211

条件

有时只想在特定条件下处理数据或过滤或输出事件,可以使用条件:

if EXPRESSION {
  ...
} else if EXPRESSION {
  ...
} else {
  ...
}

运算符:

  • 比较: ==, !=, <, >, <=, >=
  • 匹配: =~, !~
  • 包含: in, not in
  • 布尔运算符: and, or, nand, xor
  • 一元运算符: !

范例:

filter {
  if [action] == "login" {
    mutate { remove_field => "secret" }
  }
}
output {
  if [loglevel] == "ERROR" and [deployment] == "production" {
    pagerduty {
        ...
    }
  }
}
output {
  if "_grokparsefailure" not in [tags] {
    elasticsearch { ... }
  }
}

猜你喜欢

转载自blog.csdn.net/sz85850597/article/details/86547211