Logstash output by condition

You cannot use a conditional inside the output, you need the use two outputs

output {
     if [message] =~ "destination-port" {
         influxdb {
             host => ["10.200.101.18"]
             ...
             measurement => "energy-log"
             ...
        }
    } else {
         influxdb {
             host => ["10.200.101.18"]
             ...
             measurement => "tttt-log"
             ...
        }     
    }
}

The very first post I made on this site was about me making exactly this mistake :rofl:

1 Like