Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

An NLog layout that writes JSON in Compact Log Event Format (CLEF) that is compatible with Seq.

License

NotificationsYou must be signed in to change notification settings

paulem/nlog-layouts-clef

Repository files navigation

NugetNuget

An NLog layout that writes JSON in Compact Log Event FormatCLEF that is compatible withSeq.

There are situations when it is not possible to send logs directly to Seq, for example, due to enterprise security policies. In this case, a Seq-compatible JSON log can be useful, which can be manually fed to Seq usingseqcliingest command.

Getting started

After installing NLog, install theNLog.Layouts.ClefJsonLayout package from NuGet:

dotnet add package NLog.Layouts.ClefJsonLayout

Then, use theClefJsonLayout layout within the file target in your NLog configuration:

<nlog>    <extensions>        <addassembly="NLog.Layouts.ClefJsonLayout"/>    </extensions>    <targets>        <targetxsi:type="File"name="file"fileName="log.json">            <layoutxsi:type="ClefJsonLayout" />        </target>    </targets>    <rules>        <loggername="*"minlevel="Info"writeTo="file" />    </rules></nlog>

Attaching additional properties

Thelayout declaration inNLog.config can be expanded with additional properties:

<targetxsi:type="File"name="file"fileName="log.json">    <layoutxsi:type="ClefJsonLayout">        <attributename="logger"layout="${logger}"/>        <attributename="thread"layout="${threadid}"/>    </layout></target>

Any properties specified here will be attached to all outgoing events. The value can be any supportedlayout renderer.

Acknowledgements

The layout is the part of theNLog.Targets.Seq code that is responsible for generating JSON inCLEF.

About

An NLog layout that writes JSON in Compact Log Event Format (CLEF) that is compatible with Seq.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp