Syslog support on Windows

Hey guys,

So to give some background, I’m new to Golang and I am developing a small application on Windows to use at work that would send some results to a SIEM via syslog. My application was working as expected until I hit a wall when adding the last yet the most important function: sending the output to a server via syslog.

undefined: syslog.Dial
undefined: logwriter in logwriter.LOG_INFO

I was puzzled as my syntax was fine, I even compared with other code I found. Then, during my research, I found the issue 1108 saying basically that log/syslog was not implemented on Windows.

No need to say how disappointed I am after having done all this work… So I was wondering if syslog and log will some day come in the Windows implementation? Any alternatives I could use?

Thanks!

That issue looks like something about integrating more with the Windows event logger. Frankly I’m not sure why log/syslog isn’t supported on Windows. Looking at it, it defaults to writing to a Unix socket which is maybe one reason. But just removing the !windows build tag and building works for me, and I don’t immediately see anything that should break if you just do that and use the Dial() function to point towards the UDP or TCP socket of your log server.

2 Likes

You’re right! There was an answer a little lower in the thread saying:

This facility is unix specific. Does not exists on Windows.
The client portion of this package could be useful, if someone on Windows wants to
report to syslog on another unix computer.
Alternatively, this could be a start for a general log package, that reports to "system"
log. But, I am not sure, it is a good time to start such development now.
Alex

But I think I just misunderstood the reply. I’ll try removing the build tag as you said!

Thanks a lot!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.