Elias Schaechl
Elias Schaechl

Reputation: 61

c# sending messages to local syslog service on linux

Is there a way to send log messages to the local syslog service on centos 7 within a c# program? In python there is the syslog library but with c# the only way sems o be a UDP message ouver the network.

Upvotes: 4

Views: 2623

Answers (3)

Alex from Jitbit
Alex from Jitbit

Reputation: 60832

[Dislaimer: I wrote this]

Heres my "gist" with a (very) lightweight Syslog library for .NET Core that uses p/invoke into libc

https://github.com/jitbit/SyslogCore

It's only 66 lines of code, feel free to simply throw it in your project.

Upvotes: 1

Alexander Powolozki
Alexander Powolozki

Reputation: 675

You can use serilog for logging and add a syslog sink e.g.: https://github.com/vermeeca/Serilog.Sinks.Syslog or https://www.nuget.org/packages/Serilog.Sinks.SyslogMessages/

Upvotes: 1

yugami
yugami

Reputation: 379

There are several c# libraries for syslog, I used this one on a recent project

https://github.com/emertechie/SyslogNet

Upvotes: 1

Related Questions