2016-10-20 38 views
0

给定的配置无效。 Reason: Expected one of #, => at line 6, column 2 (byte 118) after给出错误的Logstash脚本

input { 
    file { 
     path => ['/opt/logstash/logstash-tutorial.log'] 
     start_position => 'beginning' 
     ignore_older => 0 2 
     } 
} 

将双引号放在字符串中会给出相同的错误消息。 我在代码的第六行得到错误。后面是ignore_older => 0 2行。由我执行运行配置文件

请帮助..

命令./logstash -f 'first-pipline.conf'

配置

input { 
    file { 
      path => ["/opt/logstash/logstash-tutorial.log"] 
      start_position => "beginning" 
      ignore_older => 0 2 
     } 
} 

这个文件的过滤器部分是注释,以表明它是

可选。

filter { 
    grok { 
      match => {"message" => "%{COMBINEDAPACHELOG}"} 
     } 
} 

output { 
} 

回答

0

file输入的ignore_older parameter接受一个数字和0 2不是数字。

修复该参数是这样,它会工作:

input { 
    file { 
     path => ['/opt/logstash/logstash-tutorial.log'] 
     start_position => 'beginning' 
     ignore_older => 0 
    } 
} 
+0

谢谢....非常感谢。它确实有效。 – Kanwar

+0

很高兴帮助! – Val