tcp 插件发生意外错误
Posted
技术标签:
【中文标题】tcp 插件发生意外错误【英文标题】:An unexpected error occurred with tcp plugin 【发布时间】:2015-01-07 21:56:52 【问题描述】:我做了一个简单的logstash配置:
tcp.conf
input
tcp
port => 22
type => syslog
filter
if [type] == "syslog"
grok
match => "message" => "%SYSLOGTIMESTAMP:syslog_timestamp %SYSLOGHOST:syslog_hostname %DATA:syslog_program(?:\[%POSINT:syslog_pid\])?: %GREEDYDATA:syslog_message"
add_field => [ "received_at", "%@timestamp" ]
add_field => [ "received_from", "%host" ]
syslog_pri
date
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
output
stdout codec => rubydebug
运行配置:
bin/logstash -f tcp.conf
执行这个命令:
telnet localhost 22
我收到此错误:
Using milestone 2 input plugin 'tcp'. This plugin should be stable, but if you see strange behavior, please let us know! For more information on plugin milestones, see http://logstash.net/docs/1.4.2/plugin-milestones :level=>:warn
Using milestone 1 filter plugin 'syslog_pri'. This plugin should work, but would benefit from use by folks like you. Please let us know if you find bugs or have suggestions on how to improve this plugin. For more information on plugin milestones, see http://logstash.net/docs/1.4.2/plugin-milestones :level=>:warn
+---------------------------------------------------------+
| An unexpected error occurred. This is probably a bug. |
| You can find help with this problem in a few places: |
| |
| * chat: #logstash IRC channel on freenode irc. |
| IRC via the web: http://goo.gl/TI4Ro |
| * email: logstash-users@googlegroups.com |
| * bug system: https://logstash.jira.com/ |
| |
+---------------------------------------------------------+
The error reported is:
Permission denied - bind(2)
我正在使用Syslog example 进行此配置
【问题讨论】:
但是 22 是 ssh 端口,而不是 syslog 端口。 【参考方案1】:“Permission denied - bind”表示logstash 无法将自己附加到列出的端口。
通常,这是因为您以非特权用户身份运行 logstash,无法访问编号低于 1024 的端口。
在您的情况下,您正在尝试连接到端口 22。作为 ssh/scp/sftp 端口,这似乎是一个奇怪的地方来查找日志文件。
【讨论】:
好的,我把端口改成8000就可以了,但是如果我想检查22端口呢?我该怎么做? logstash 正在尝试从该端口读取日志;您希望哪些日志位于 ssh 端口上?如果您确实需要绑定到该端口,则需要关闭 ssh 并以 root 身份运行 logstash。请不要这样做。以上是关于tcp 插件发生意外错误的主要内容,如果未能解决你的问题,请参考以下文章
错误:加载 PostCSS 插件失败:令牌无效或意外(Vue.js、tailwind css)
SignTool 错误:发生了意外的内部错误。错误 MSB3482