Eric B.
Eric B.

Reputation: 24441

Howto log to syslog in bash script in cygwin?

How do I log messages to syslog using a bash script in cygwin? In a standard linux disto, I can use a logger(1) utility, but I cannot seem to find that utility in cygwin anywhere. I've installed the syslog-ng package, but still cannot seem to find the utility anywhere.

Am I missing something somewhere? Is this even feasible from within a cygwin bash script?

Upvotes: 1

Views: 2123

Answers (2)

Zombo
Zombo

Reputation: 1

Perhaps try util-linux package.

Upvotes: 2

ccarton
ccarton

Reputation: 3666

If you don't care about adhering to the syslog protocol you can always just send the message directly to the syslog port with nc:

echo "Some message" | nc localhost 514

Syslog-ng will be nice about logging your message to some reasonable default destination even though there is no syslog header.

If you need to specify facility or severity you could craft a syslog header yourself. The format isn't very complicated: https://www.rfc-editor.org/rfc/rfc5424

Upvotes: 1

Related Questions