DocSpace-buildtools/config/nlog.config

66 lines
4.3 KiB
Plaintext
Raw Normal View History

2023-10-02 10:16:45 +00:00
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwConfigExceptions="true"
autoReload="true">
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
<add assembly="NLog.AWS.Logger" />
2024-03-03 15:30:45 +00:00
<add assembly="NLog.Targets.ElasticSearch"/>
2023-10-02 10:16:45 +00:00
</extensions>
<variable name="dir" value="..\Logs\"/>
<variable name="name" value="web"/>
<targets async="true">
<default-target-parameters type="File" maxArchiveDays="30" archiveNumbering="DateAndSequence" archiveEvery="Day" enableArchiveFileCompression="true" archiveAboveSize="52428800" archiveDateFormat="MM-dd" layout="${date:format=yyyy-MM-dd HH\:mm\:ss,fff} ${level:uppercase=true} [${threadid}] ${logger} - ${message} ${exception:format=ToString}"/>
<target name="web" type="File" fileName="${var:dir}${var:name}.log" />
<target name="sql" type="File" fileName="${var:dir}${var:name}.sql.log" layout="${date:universalTime=true:format=yyyy-MM-dd HH\:mm\:ss,fff}|${threadid}|${event-properties:item=elapsed}|${replace:inner=${event-properties:item=commandText}:searchFor=\\r\\n|\\s:replaceWith= :regex=true}|${event-properties:item=parameters}"/>
<target name="ownFile-web" type="File" fileName="${var:dir}${var:name}.asp.log" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
2023-10-03 15:13:51 +00:00
<target name="lifetimeConsole" type="Console" layout="${MicrosoftConsoleLayout}" />
2023-10-02 10:16:45 +00:00
<target type="AWSTarget" name="aws" logGroup="/asc/docspace/cluster/cluster_name/general" region="us-east-1" LogStreamNamePrefix="${hostname} - ${application-context}">
<layout xsi:type="JsonLayout" includeEventProperties="true" includeScopeProperties="true" maxRecursionLimit="2">
<attribute name="date" layout="${date:format=yyyy-MM-dd HH\:mm\:ss,fff}" />
<attribute name="level" layout="${level:upperCase=true}"/>
<attribute name="instanceId" layout="${hostname}"/>
<attribute name="applicationContext" layout="${application-context}"/>
<attribute name="sourceContext" layout="${logger}"/>
<attribute name="threadId" layout="${threadid}"/>
<attribute name="message" layout="${message}" />
<attribute name="exception" layout="${exception:format=ToString}" />
</layout>
</target>
<target type="AWSTarget" name="aws_sql" logGroup="/asc/docspace/cluster/cluster_name/sql" region="us-east-1" LogStreamNamePrefix="${hostname} - ${application-context}">
<layout xsi:type="JsonLayout" includeEventProperties="true" includeScopeProperties="true">
<attribute name="date" layout="${date:universalTime=true:format=yyyy-MM-dd HH\:mm\:ss,fff}" />
<attribute name="instanceId" layout="${hostname}"/>
<attribute name="applicationContext" layout="${application-context}"/>
<attribute name="sourceContext" layout="${logger}"/>
<attribute name="threadId" layout="${threadid}"/>
<attribute name="elapsed" layout="${event-properties:item=elapsed}"/>
<attribute name="commandText" layout="${replace:inner=${event-properties:item=commandText}:searchFor=\\r\\n|\\s:replaceWith= :regex=true}" />
</layout>
</target>
2024-03-03 15:30:45 +00:00
<target name="elastic" xsi:type="BufferingWrapper" flushTimeout="5000">
<target xsi:type="ElasticSearch" includeAllProperties="true" />
</target>
2023-10-02 10:16:45 +00:00
</targets>
<rules>
<logger name="ASC.Api.Core.Auth.CookieAuthHandler" maxlevel="Off" final="true" />
2023-10-02 10:16:45 +00:00
<logger name="ASC.SQL" minlevel="Debug" writeTo="sql" final="true" />
<logger name="ASC*" minlevel="Debug" writeTo="web">
<filters defaultAction="Log">
2023-11-05 15:36:21 +00:00
<when condition="regex-matches('${scope-property:RequestPath}', '^/health/?$', 'ignorecase,singleline')" action="Ignore" />
2023-10-02 10:16:45 +00:00
</filters>
2023-10-03 15:13:51 +00:00
</logger>
2023-10-02 10:16:45 +00:00
<logger name="Microsoft.AspNetCore.Hosting.Diagnostics" minlevel="Debug" writeTo="ownFile-web" final="true">
<filters defaultAction="Log">
2023-11-05 15:36:21 +00:00
<when condition="regex-matches('${scope-property:RequestPath}', '^/health/?$', 'ignorecase,singleline')" action="Ignore" />
2023-10-02 10:16:45 +00:00
</filters>
</logger>
2024-03-06 12:46:34 +00:00
<logger name="Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware" maxlevel="Information" writeTo="ownFile-web" final="true" />
2023-10-02 10:16:45 +00:00
<logger name="Microsoft.*" maxlevel="Off" final="true" />
2023-10-03 15:13:51 +00:00
<logger name="System.Net.Http.*" maxlevel="Info" final="true" />
2023-10-02 10:16:45 +00:00
</rules>
2019-11-15 08:47:56 +00:00
</nlog>