2017-01-03 293 views
0

我对elasticsearch-kibana-logstash非常陌生,似乎无法找到此解决方案。在不使用kibana的情况下在kibana中创建索引

我试图创建索引,我将在kibana中看到,而不必在开发工具部分使用POST命令。

我已经设置test.conf-

input { 
file { 
    path => "/home/user/logs/server.log" 
    type => "test-type" 
    start_position => "beginning" 
} 
} 

output { 
elasticsearch { 
    hosts => ["localhost:9200"] 
    index => "new-index" 
} 
} 

然后

从logstash目录bin/logstash -f test.conf

我所得到的是,我无法找到kibana新指数(指数模式部分),当我使用elasticsearch - http://localhost:9200/new-index/它提出了一个错误,当我去http://localhost:9600/(它显示的端口)它似乎没有任何错误

非常感谢您的帮助!

+0

你的意思是你在'http:// localhost:9200'的索引列表中找不到你正在试图使用'logstash'创建的'new-index'? – Kulasangar

+0

在kibana中找不到它..难道不是假设去那里...? – Dardar1991

+0

我也尝试设置'hosts => [“http:// localhost:5601 /”]'(kibana的端口),但没有成功 – Dardar1991

回答

0

其实我已经成功,即使没有在Kibana

首先创建它我用下面的配置文件创建索引 -

input { 
    file { 
    path => "/home/hadar/tmp/logs/server.log" 
    type => "test-type" 
    id => "NEWTRY" 
    start_position => "beginning" 
} 
} 

filter { 
    grok { 
    match => { "message" => "%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} %{HOUR:hour}:%{MINUTE:minute}:%{SECOND:second} - %{LOGLEVEL:level} - %{WORD:scriptName}.%{WORD:scriptEND} - " } 
    } 
} 

output { 
    elasticsearch { 
    hosts => ["localhost:9200"] 
    index => "new-index" 
    codec => line { format => "%{year}-%{month}-%{day} %{hour}:%{minute}:%{second} - %{level} - %{scriptName}.%{scriptEND} - \"%{message}\"" } 
    } 
} 

我确信,该​​指数是不是已经在Kibana(我试着用其他的索引名字来确定......),并且最终我在Kibana(我在索引模式部分添加了它)和Elasticsearch时看到了索引与日志信息(当我去了http://localhost:9200/new-index

唯一我应该的这样做是为了消除其每Logstash后data/plugins/inputs/file/下创建的.sincedb_XXX文件运行

OR

其他解决方案(仅适用于测试环境)是添加sincedb_path=>"/dev/null"到指示不创建输入文件的插件.sincedb_XXX文件

0

很显然,您将无法找到您在Kibana中使用logstash创建的索引,除非您在KibanaManagemen部分中手动创建索引。

请确保您使用logstash创建的指示名称相同。看一看在doc,传达:

当你定义的索引模式,匹配模式必须 在Elasticsearch存在该指数。这些指数必须包含数据。

这几乎说明指数应该存在为您创建索引Kibana。希望能帮助到你!

+0

谢谢我想我错过了解这些工具的概念......我认为这是所有连接的工具,但我想这不是 – Dardar1991

+0

是的。它基本上是一堆产品,它有自己的处理方式。但是,ES作为堆栈的核心。 – Kulasangar

相关问题