2016-08-17 105 views
0

我想知道我的配置是否正确。logstash输入和输出的正确配置是什么?

我的配置(在文件logstash_conf /第一pipeline.conf)是:

input { 
    file { 
    path => "/opt/logstash/bin/logstash_conf/logstash-tutorial-dataset.log" 
    start_position => beginning 
    } 
} 

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

    geoip { 
    source => "clientip" 
    } 
} 

output { 
    elasticsearch {} 

    stdout {} 
} 

我refered以下配置:
https://www.elastic.co/guide/en/logstash/current/advanced-pipeline.html

但是当我尝试运行logstash时,出现以下错误:

[[email protected] bin]# ./logstash -f ./logstash_conf/first-pipeline.conf 
Settings: Default pipeline workers: 16 
Connection refused {:class=>"Manticore::SocketException", :level=>:error} 
Pipeline main started 

任何帮助将被衷心感谢。

+0

您的ES服务器是否正在运行?执行'curl -XGET locahost:9200'时会得到什么?如果你注释掉'elasticsearch {}'输出,它会起作用吗? – Val

+0

该配置没有任何语法错误,问题来自与Elasticsearch的连接,预计可在localhost:9200上访问(默认情况下为9200),因为您没有指定任何主机。 – baudsp

回答

1

Connection refused表示Lostash无法连接到Elasticsearch。

要遵循此example,您应该确保您的Elasticsearch与Logstash在同一台计算机上运行。

[email protected] bin]# curl http://localhost:9200 

上述命令应返回Elastichsearch响应。

output { 
elasticsearch {} 
stdout {} 
} 

上面的例子假定Logstash和Elasticsearch在同一个实例上运行。您可以使用如下主机配置指定远程Elasticsearch实例(即192.168.1.1):

output { 
elasticsearch { 
    hosts => [ "192.168.1.1:9200" ] 
} 
stdout {} 
} 
+0

感谢您的回复。现在我运行确定,我的CONFIGRATION如下:输入{ 文件{ 路径=> “/opt/logstash/bin/logstash_conf/Debug.log” 类型=> “ttlog” } } 输出{ elasticsearch { 主机=> “* * * *:9200” 指数=> “tt_index” } 标准输出{编解码器=> json_lines} } – laoyang360