简体   繁体   English

如何调试logstash文件插件

[英]How to debug the logstash file plugin

Is it possible to log actions of the logstash file plugin? 是否可以记录logstash文件插件的操作? (ie what files it tries to send, what errors happen, etc) (即它试图发送什么文件,发生什么错误等)

在新版本中,stdout格式发生了变化

stdout { codec => rubydebug }

If you want to debug the process itself you may run it like this 如果要调试进程本身,可以像这样运行它

/opt/logstash/bin/logstash -f yourconf.conf -v --debug --verbose

NOTE: According to @neeraj-gupta using --debug and --verbose at the same time may cause a problem when trying to see debug logs of cloudwatch and using only --debug is enough. 注意:根据@ neeraj-gupta使用--debug--verbose同时可能会在尝试查看cloudwatch的调试日志时出现问题而仅使用--debug就足够了。

So realistically something like this is more apt: 所以现实地这样的事情更贴切:

/opt/logstash/bin/logstash -f yourconf.conf --debug

* * * This method of debugging is now deprecated - see Max's answer above! * * *此调试方法现已弃用 - 请参阅上面的Max答案! * * * * * *

Try adding a stdout output with debug set to true. 尝试添加调试设置为true的stdout输出。 You should be able to see the entire event object and errors / warnings in your logstash --log or stdout. 您应该能够在logstash --log或stdout中查看整个事件对象和错误/警告。

input {
   file {
      ...
   }
}
output {
   stdout {
      debug => true
   }
   ...
}

Hope that helps! 希望有所帮助!

Yes, you can see what files it tries to send, what errors happening through the output section by applying: 是的,您可以通过以下方式查看它尝试发送的文件,输出部分发生的错误:

stdout { codec => rubydebug }

Codec is responsible for giving output. 编解码器负责提供输出。 So, here it outputs your event data using the ruby "awesome_print" library. 所以,在这里它使用ruby“awesome_print”库输出你的事件数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM