刚开始搞heka,觉得潜力很大,但是很多概念和配置不清楚。
官方开源地址:https://github.com/mozilla-services/heka
下面是配置文件,
功能是想配置实现通过TCP和UDP接收日志,
然后显示出来。
UdpInput可以正常接受并显示日志;
但是配置TcpInput,能连接上但是输出的日志都为空:
```
[syslog_splitter]
type = "RegexSplitter"
delimiter = '[\S]*\n'
delimiter_eol = false
[TcpInput]
address = ":514"
splitter = "syslog_splitter"
[UdpInput]
address = ":514"
[PayloadEncoder]
append_newlines = true
[LogOutput]
message_matcher = "TRUE"
encoder = "PayloadEncoder"
```
如下配置可以正常接收 tcp 日志:
```
[newline_splitter]
type = "TokenSplitter"
delimiter = '\n'
[prdecoder]
type = "PayloadRegexDecoder"
match_regex = '(\S*\n)'
[TcpInput]
address = ":514"
splitter = "newline_splitter"
decoder = "prdecoder"
use_tls = false
[UdpInput]
address = ":514"
[PayloadEncoder]
append_newlines = true
[LogOutput]
message_matcher = "TRUE"
encoder = "PayloadEncoder"
```
这段时间工作主要是heka,准备继续深入学习一下并写一个开源的工具书,希望有同好一起学习交流。
抱歉这段时间比较忙,还什么都没写:https://github.com/wangfeiping/hekabook
更多评论
前段时间调试可以接收了,好像tcp和udp在heka的内部处理机制不太一样
···
[newline_splitter]
type = "TokenSplitter"
delimiter = '\n'
[prdecoder]
type = "PayloadRegexDecoder"
match_regex = '(\S*\n)'
[TcpInput]
address = ":514"
splitter = "newline_splitter"
decoder = "prdecoder"
use_tls = false
[UdpInput]
address = ":514"
[PayloadEncoder]
append_newlines = true
[LogOutput]
message_matcher = "TRUE"
encoder = "PayloadEncoder"
···
#3