Rsyslog omhttp(HTTP 输出模块)

使用 Rsyslog 的 omhttp 模块可以将收集的日志数据以 HTTP 请求的方式输出。该模块支持单条/批量发送数据,支持 GZIP 压缩,支持 HTTPS。

Rsyslog 默认未包含 omhttp 模块,需要重新编译。编译过程参考我的博文:
CentOS 7.3 编译 Rsyslog 8.1903.0
CentOS 6.5 编译 Rsyslog 8.1903.0

CentOS 6.5 系统下编译比较麻烦,可以下载我编译后的 so 文件:CentOS 6.5 编译 omhttp.so 下载

一个简单的配置示例如下:

module(load="omhttp")
template(name="tpl1" type="string" string="{\"type\":\"syslog\", \"host\":\"%HOSTNAME%\"}")
action(
    type="omhttp"
    server="127.0.0.1"
    serverport="8080"
    restpath="events"
    template="tpl1"
    action.resumeRetryCount="3"
)