【发布时间】:2019-03-22 19:14:57
【问题描述】:
我正在尝试在 asp.net core 2.2 项目中设置系统日志,但我找不到任何可以解释这一点的东西。 NLog.Target.Syslog 上的示例代码对新手来说解释不够。我已经使用示例代码设置日志记录到文件。
<target xsi:type="Syslog" name="cee-udp">
<sl:layout xsi:type="SimpleLayout" text="@cee: {"message": "${message}"}" />
<sl:messageCreation>
<sl:facility>Local4</sl:facility>
<sl:rfc>Rfc5424</sl:rfc>
<sl:rfc5424>
<sl:hostname xsi:type="SimpleLayout" text="${machinename}" />
<sl:appName xsi:type="SimpleLayout" text="DAEMON.MyAppName" />
<sl:procId xsi:type="SimpleLayout" text="${processid}" />
<sl:msgId xsi:type="SimpleLayout" text="${threadid}" />
<sl:disableBom>true</sl:disableBom>
</sl:rfc5424>
</sl:messageCreation>
</target>
您能否解释一下我应该为 machinename 输入什么 - 是目标主机还是源主机?如何指定 syslog 服务器的 IP?什么是 process 和 threadID,它从哪里获取变量?
我在另一台机器上运行 Virtual Syslog Server 来测试它。
【问题讨论】:
-
示例中的布局渲染器是内置的NLog,见nlog-project.org/config/?tab=layout-renderers
-
我认为在这里问这个问题是明智的:github.com/luigiberrettini/NLog.Targets.Syslog/issues
-
谢谢 - 我只是需要一些关于从哪里开始的指导:)
标签: configuration nlog syslog