rsyslog-如果条件

发布于 2025-02-11 18:19:21 字数 404 浏览 1 评论 0原文

我的应用程序是通过UDP将日志发送到json-formatt(嵌套)的日志。

{"http": {"status_code": 400}}

我想解析此日志,并将属性用作if诸如rsyslog conf中的条件中的变量。

if ($!http!status_code >= 400) then {
    /var/log/haproxy/haproxy-traffic-error.log
    stop
}

这可能吗?这个问题让我现在发疯。 我已经寻找了许多有关mmjsonparsemmnormalize等的文章。

My application is sending log which is json-formatted (nested) to rsyslog via UDP like below.

{"http": {"status_code": 400}}

I want to parse this log and use property as a variable in if condition like in rsyslog conf.

if ($!http!status_code >= 400) then {
    /var/log/haproxy/haproxy-traffic-error.log
    stop
}

Is this possible? This issue is making me crazy now.
I have looked for many articles about mmjsonparse, mmnormalize and etc...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文