基巴纳没有显示任何日志(麋鹿堆)
我正在学习麋鹿堆栈。因此,我编写了一个示例Java代码,该代码在文件中流出了一些日志行。我正在尝试查看kibana UI中的日志线是否显示。因此,我将尝试为我的能力解释一下我的所作所为。因此,首先,我启动Elasticsearch,然后是Logstash,然后是Kibana。
我的logstash配置文件看起来像:
input {
file {
type => "java"
path => "C:/temp/logs/application.log"
codec => multiline {
pattern => "^%{MONTHDAY}/%{MONTHNUM}/%{YEAR} %{TIME}.*"
negate => "true"
what => "previous"
}
}
}
filter {
grok {
match => { "message" => "%{DATE_EU:date} %{TIME:time} %{ISO8601_TIMEZONE:zone} \[%{LOGLEVEL:loglevel}.*] \[%{DATA:thread}] %{DATA:class} - %{GREEDYDATA:message}" }
add_tag => [ "log" ]
}
}
output {
stdout {
codec => rubydebug
}
# Sending properly parsed log events to elasticsearch
elasticsearch {
hosts => ["localhost:9200"]
}
}
日志文件中的日志如下:
07/06/2022 14:37:41.471 +0530 [ERROR] [main] com.cmt.ncaas.logging.LoggingTrial - Trying to log an error
07/06/2022 14:37:41.471 +0530 [DEBUG] [main] com.cmt.ncaas.logging.LoggingTrial - Trying to log an debug
07/06/2022 14:37:41.471 +0530 [TRACE] [main] com.cmt.ncaas.logging.LoggingTrial - Trying to log an trace
07/06/2022 14:37:41.471 +0530 [WARN ] [main] com.cmt.ncaas.logging.LoggingTrial - Trying to log an warn
07/06/2022 14:37:41.471 +0530 [ERROR] [main] com.cmt.ncaas.logging.LoggingTrial - Exception occured:
java.lang.ArithmeticException: / by zero
at com.cmt.ncaas.logging.LoggingTrial.exceptionLogging(LoggingTrial.java:39)
at com.cmt.ncaas.logging.LoggingTrial.main(LoggingTrial.java:32)
在此之后,我创建了一个带有模式 logs的索引模板 - *
。但是我看不到奇巴纳出现任何东西。
你能告诉我我出了什么问题吗?我怀疑是输入部分将其弄乱。但是变新,我不确定我可以改变什么。
任何指针,我都非常感谢。提前致谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您缺少Elasticsearch输出上的“索引”。
如果您没有指定,则将日志进行:
“ logstash-%{+yyyy.mm.dd}”
或者
“ ecs-logstash - %{+yyyy.mm.dd}”
那些不匹配您的logs-*索引模式。
这应该解决:
祝您好运
You're missing the "index" on elasticsearch output.
If you don't specify that, the logs are going to either:
"logstash-%{+yyyy.MM.dd}"
OR
"ecs-logstash-%{+yyyy.MM.dd}"
Those do not match your logs-* index pattern.
See the documentation here and search the index section
This should solve:
Good luck