首页 > 其他分享 >nlog.config 输出到ELK的配置

nlog.config 输出到ELK的配置

时间:2023-02-01 10:46:25浏览次数:45  
标签:ELK false longdate level stacktrace uppercase nlog message config

<nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<variable name="appName" value="server.demo"/>
<targets>
<!-- 本地文件日志target -->
<target xsi:type="File"
name="file"
archiveAboveSize="20000000"
fileName="${basedir}/Log/${shortdate}/${lowercase:${level}}.log"
layout="${longdate} | ${level:uppercase=false} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"
keepFileOpen="false"
archiveNumbering="Rolling"
encoding="UTF-8"
enableFileDelete="true"
maxArchiveFiles="5"
/>

<!-- Tcp日志target -->
<target
name="network"
xsi:type="Network"
address="udp://127.0.0.1:5044"
layout="#${longdate}#${uppercase:${level}}#${appName}#${message}#${exception:format=ToString}#${stacktrace}#"
>
</target>

<!--空白-->
<target xsi:type="Null" name="blackhole" />
</targets>
<rules>
<!--自定义日志,排除Microsoft日志-->
<logger name="Microsoft.*" minlevel="Trace" writeTo="blackhole" final="true" />
<logger name="*" minlevel="Debug" writeTo="file" />
<logger name="*" minlevel="Debug" writeTo="network" />
</rules>
</nlog>

标签:ELK,false,longdate,level,stacktrace,uppercase,nlog,message,config
From: https://www.cnblogs.com/94cool/p/17081759.html

相关文章

  • springboot Config类@Import导入Config类中bean覆盖方法
    spring-cloud-openfeign-core第三方包里面有FeignClientsConfiguration.class里面是包括了feign需要的bean,但里面已经定义了feignEncoder、feignDecoder,如果项目中想要定制......
  • xml Configuration File的Spring Config没有(2021版本的idea)
    1.查看是否下载了spring2.在pom文件中引入spring依赖3.更新maven4.此时还没有显示的话,点击setting查看maven的路径,建议不要使用系统默认的路径因为这样的话,下载的十分......
  • IDEA加载大文件时报错:The file size exceeds configured limit
    1,问题描述1Thefilesizeexceedsconfiguredlimit2,解决方案:配置一下idea.properties文件3,添加如下配置1idea.max.intellisense.filesize=500004,重启idea,完......
  • @ContextConfiguration的用法
    @ContextConfiguration的用法在SpringBoot测试@ContextConfiguration这个注解通常与@RunWith(SpringJUnit4ClassRunner.class)联合使用用来测试当一个类添加了注解@Com......
  • .NET7后端框架:NLog
    前言继上一篇《.NET7后端框架:一句话启动》后,继续完善后端框架。查日志作为码农的日常,所以我们先引入日志包,这里我们使用NLog。添加依赖项添加包的方式有两种,一种是通......
  • linux--systemctl、service和chkconfig
    一、systemctl1、centos7下,systemctl可以理解为systemd的一个工具。也可以认为systemctl命令将service和chkconfig命令结合在了一起,它永久性或只在当前会话中启用/禁用服务......
  • stylelint.config.js
    module.exports={extends:['stylelint-config-standard-scss'],plugins:['stylelint-scss'],rules:{indentation:[2],'max-empty-lines':1,......
  • Jmeter - Config Tips
    Guideline:Jmeter.propertiesfileshouldavoidtobemodified,modifieduser.propertiesinstead>>copythepropertyinJmeter.propertiesintouser.properties......
  • spring boot configuration annotation processor not configured
     https://www.cnblogs.com/lyluoye/p/16602668.html https://www.freesion.com/article/76161512981/         <dependency>           <gr......
  • k8s~fluentd从kafka到elk
    有时为了日志解耦,通常不把日志打到文件,而是直接打到kafka,而为了分析日志,我们可以通过sidecar的方式,把日志从kafka写入到es里,而通过kibana对日志进行分析。我的k8s-fluentd......