Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to write to kiwi syslog server log c#

I have a program that I need to send some logs into Kiwi Syslog Server. I have looked around the net for a guide in c#, but I found nothing. I would like to have an easy to understand explanation of how to do it.

Whenever someone clicks on a button or does something important, I just want to be able to write a log entry for it. So, really all I need is an example on how you send entries to the Syslog Server.

I don't have any example code of what I already did because I found nothing that I can show off. I hope that i don't break the rules of this site by not showing any code already. But believe me, I tried to look around the net for it.

Thanks a lot for your help guys!

like image 280
Alon M Avatar asked Jan 06 '14 14:01

Alon M


1 Answers

There's an awesome open-source SysLog Library for .Net: SyslogNet.

Here's an example where I create a sender, create a message and send it:

_syslogSender = new SyslogUdpSender("localhost",514);
_syslogSender.Send(
    new SyslogMessage(
        DateTime.Now,
        Facility.SecurityOrAuthorizationMessages1,
        Severity.Informational,
        Environment.MachineName,
        "Application Name",
        "Message Content"),
    new SyslogRfc3164MessageSerializer());
like image 97
i3arnon Avatar answered Sep 20 '22 06:09

i3arnon