【发布时间】:2017-08-02 18:00:28
【问题描述】:
我阅读了以下文章以了解我建立 ELK 环境的 logstash 技术。 https://tpodolak.com/blog/tag/kibana/
input {
file {
path => ["C:/logs/*.log"]
start_position => beginning
ignore_older => 0
}
}
filter {
grok {
match => { "message" => "TimeStamp=%{TIMESTAMP_ISO8601:logdate} CorrelationId=%{UUID:correlationId} Level=%{LOGLEVEL:logLevel} Message=%{GREEDYDATA:logMessage}" }
}
# set the event timestamp from the log
# https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html
date {
match => [ "logdate", "yyyy-MM-dd HH:mm:ss.SSSS" ]
target => "@timestamp"
}
}
output {
elasticsearch {
hosts => "localhost:9200"
}
stdout {}
}
我在 logstash.conf 中添加了输入路径 C/logs/*.log。我的 test.log 文件不为空,它有:
TimeStamp=2016-07-20 21:22:46.0079 CorrelationId=dc665fe7-9734-456a-92ba-3e1b522f5fd4 Level=INFO Message=About
TimeStamp=2016-07-20 21:22:46.0079 CorrelationId=dc665fe7-9734-456a-92ba-3e1b522f5fd4 Level=INFO Message=About
TimeStamp=2016-11-01 00:13:01.1669 CorrelationId=77530786-8e6b-45c2-bbc1-31837d911c14 Level=INFO Message=Request completed with status code: 200
根据上面的文章。我必须看到我的日志在弹性搜索中。 (来自“https://tpodolak.com/blog/tag/kibana/”示例结果) 但是如果我将这个地址写到我的浏览器中,我的结果是:http://localhost:9200/_cat/indices?v 我在 elasticsearch 中看不到 logstash 日志?弹性搜索中的logstash日志存储在哪里? logstash.conf 看起来不错。但没有满意的结果。因此。我想通过logstash从C/logs/*.log下获取所有日志到弹性?但是我的 logstash.conf 中的错误是什么?
我的日志(C:\monitoring\logstash\logs\C:\monitoring\logstash\logs.log):
[2017-03-13T10:47:17,849][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
[2017-03-13T11:46:35,123][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
[2017-03-13T11:48:20,023][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
[2017-03-13T11:55:10,808][INFO ][logstash.pipeline ] Starting pipeline {"id"=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>500}
[2017-03-13T11:55:10,871][INFO ][logstash.pipeline ] Pipeline main started
[2017-03-13T11:55:11,316][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2017-03-13T12:00:52,188][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
[2017-03-13T12:02:48,309][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
[2017-03-13T12:06:33,270][ERROR][logstash.agent ] Cannot load an invalid configuration {:reason=>"Expected one of #, => at line 1, column 52 (byte 52) after output { elasticsearch { hosts "}
[2017-03-13T12:08:51,636][ERROR][logstash.agent ] Cannot load an invalid configuration {:reason=>"Expected one of #, => at line 1, column 22 (byte 22) after input { file { path "}
[2017-03-13T12:09:48,114][ERROR][logstash.agent ] Cannot load an invalid configuration {:reason=>"Expected one of #, => at line 1, column 22 (byte 22) after input { file { path "}
[2017-03-13T12:11:40,200][ERROR][logstash.agent ] Cannot load an invalid configuration {:reason=>"Expected one of #, => at line 1, column 22 (byte 22) after input { file { path "}
[2017-03-13T12:19:17,622][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
【问题讨论】:
-
logstash 输出是什么?
-
@asettouf;我的 logstash 输出但是:输出 { elasticsearch { hosts => "localhost:9200" } stdout {} }
-
对不起,我的意思是控制台或logstash日志中的输出
-
如何在控制台上查看我的日志? localhost:9200/_cat/indices?v
-
我的日志文件有:TimeStamp=2016-07-20 21:22:46.0079 CorrelationId=dc665fe7-9734-456a-92ba-3e1b522f5fd4 Level=INFO Message=About TimeStamp=2016-07-20 21 :22:46.0079 CorrelationId=dc665fe7-9734-456a-92ba-3e1b522f5fd4 Level=INFO Message=关于时间戳=2016-11-01 00:13:01.1669 CorrelationId=77530786-8e6b-45c2-bbc1-31837d911c4 Message=INFO完成状态码:200
标签: elasticsearch logging logstash devops logstash-grok