logstash的NLOG配置

发布于 2025-02-13 18:03:02 字数 1361 浏览 1 评论 0原文

假设一个大约20个生产商生成应用程序诊断数据(日志)的系统,每个系统都使用以下NLOG logStash目标配置:

    <!-- https://github.com/NLog/NLog/wiki/Network-target -->
    <target xsi:type="Network" name="logstash"
            address="tcp://logstash-server:port"
            newLine="true"
            maxMessageSize="65000" onOverflow="Discard"
            connectionCacheSize="5" keepConnection="True" KeepAliveTimeSeconds="30" >
      <layout xsi:type="JsonLayout" includeAllProperties="true">
        ...
      </layout>
    </target>

我有以下注意事项,您的意见将不胜感激:

  • 将LogStash Target用BufferingWrapper包装logstash目标是有意义的?这会导致一条巨大消息,可能超过maxMessagesize
  • 还是出于某种原因使用asyncwrapper更好?
  • 鉴于每个有20个生产商保持5个连接,是否有任何可以击中的TCP限制?

我想首先从强耦合开始,然后才考虑将日志记录到日志文件中,然后将其运送到LogStash。还感谢任何有用的参考文献或较大项目的GitHub示例。

References:

https://github.com/nlog/nlog/wiki/BufferingWrapper-target< /a>

https://github.com/nlog/nlog/nlog/nlog/wiki/wiki/ashyncwrapper-target-target-target-target-target-target-target-target

Assume a system of about 20 producers generating application diagnostic data (logs), each using the following NLog logstash target configuration:

    <!-- https://github.com/NLog/NLog/wiki/Network-target -->
    <target xsi:type="Network" name="logstash"
            address="tcp://logstash-server:port"
            newLine="true"
            maxMessageSize="65000" onOverflow="Discard"
            connectionCacheSize="5" keepConnection="True" KeepAliveTimeSeconds="30" >
      <layout xsi:type="JsonLayout" includeAllProperties="true">
        ...
      </layout>
    </target>

I have the following considerations and your opinion would be appreciated:

  • Would it make sense to wrap the logstash target with BufferingWrapper? Will this result in one giant message, possibly exceeding the maxMessageSize?
  • Or is it better to use the AsyncWrapper for some reason?
  • Given that 20 producers each hold 5 connections, are there any TCP limits which can be hit?

I would like to start with strong coupling first and only later consider logging to log files which are then shipped to logstash. Any useful references or github examples for larger projects are also appreciated.

References:

https://github.com/nlog/nlog/wiki/BufferingWrapper-target

https://github.com/NLog/NLog/wiki/AsyncWrapper-target

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柒夜笙歌凉 2025-02-20 18:03:02

根据网络目标的工作原理,我认为不需要任何包装器。网络目标已经包含一个队列,该队列可以在完整时删除消息。因此,目前以下是一个合理的配置:

    <!-- https://github.com/NLog/NLog/wiki/Network-target -->
    <!-- TCP protocol must be used and newLine is critical -->
    <target xsi:type="Network" name="logstash"
            address="tcp://logstash-server:port"
            newLine="true"
            maxMessageSize="65000" onOverflow="Discard"
            maxQueueSize="10000"
            connectionCacheSize="5" keepConnection="True" KeepAliveTimeSeconds="30" >
      <layout xsi:type="JsonLayout" includeAllProperties="true">
        ...
      </layout>
    </target>

Based on the how the Network target works I think there is no need for any wrappers. The network target already contains a queue which can drop messages when full. So at the moment the following is a reasonable configuration to start with:

    <!-- https://github.com/NLog/NLog/wiki/Network-target -->
    <!-- TCP protocol must be used and newLine is critical -->
    <target xsi:type="Network" name="logstash"
            address="tcp://logstash-server:port"
            newLine="true"
            maxMessageSize="65000" onOverflow="Discard"
            maxQueueSize="10000"
            connectionCacheSize="5" keepConnection="True" KeepAliveTimeSeconds="30" >
      <layout xsi:type="JsonLayout" includeAllProperties="true">
        ...
      </layout>
    </target>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文