bpaquet / node-logstash

Simple logstash implmentation in nodejs : file log collection, sent with zeromq
Other
517 stars 141 forks source link

if statements error #153

Open gui66497 opened 4 years ago

gui66497 commented 4 years ago

My origin filter:

filter {
    if ![ipv4] {
        drop{
          id => "drop nmap data"
        }
    }
}

the parser seem to can not understand it and throw an error:

Error in created hook: "Error: Parse error on line 11:
...ter {   if [ipv4] {  drop{  id => "d
---------------------^
Expecting 'BINARY_OPERATOR', got 'START'"

Does the jison paser just do not support this? So i have to change my conditon to if [ipv4] != null?

gui66497 commented 4 years ago

And in another filter:

filter {
    if [status][state] == "down" {
        elasticsearch {
            user => elastic
            password => changeme
            ...
        }
    }
}

I get another error:

Error: Parse error on line 23:
...  }    if [status][state] == "down" {
---------------------^
Expecting 'START', 'CONDITION_OPERATOR', 'BINARY_OPERATOR', 'PARENTHESIS_STOP', got 'ARRAY_START'

Seem the paser only support one value. I never touch the jison paser before,so can i solve this kind problem by edit the paser?