Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

logstash if statement within output

This simple config file has an error. I've tried everything I can think of to fix it. I've simplified this example. Ultimately I'd like to use multiple input files and send them to different ports on the output.

input {
  file {
    path => "/home/user/log/*"
    type => "test1"
    start_position => "beginning"
  }
}

output {
  syslog {

    host => "server.com"

    if [type] == "test1" {
      port => 5555
    }

    severity => "informational"
    facility => "syslogd"
  }
}

The error is:

Error: Expected one of #, => at line 14, column 8 (byte 168) after output {
  syslog {

    host => "server.com"

    if

logstash is running on ubuntu:

apt --installed list|grep logstash
logstash/stable,now 1.4.3-1-7e387fb all [installed]
like image 684
linuxfix Avatar asked Jun 25 '15 20:06

linuxfix


1 Answers

I found the problem. I needed to move "syslog" like this:

output {
  if [type] == "test1" {
    syslog {
      host => "server.com"
      port => 5555
      severity => "informational"
      facility => "syslogd"

    }
 }
}
like image 90
linuxfix Avatar answered Sep 28 '22 16:09

linuxfix