syslogd: logging different device's log to different files on windows
Most of the syslog server (syslogd) on Widows cannot change the default listening port number (udp 514).
If there are may devices remote syslog to a syslog server with dynamic ip address, without correct host name, it may not able to know which log belongs to which device.
I found that syslog4j already implement syslog server with configurable port number and log file name:
Usage:SyslogServer [-h <host>] [-p <port>] [-o <file>] [-a] [-q] <protocol>-h <host> host or IP to bind-p <port> port to bind-t <timeout> socket timeout (in milliseconds)-o <file> file to write entries (overwrites by default)-a append to file (instead of overwrite)-q do not write anything to standard outprotocol Syslog4j protocol implementation (tcp, udp, ...)
Example:
Run sysylogd on port 514 and log to log1.txt
# java -cp syslog4j.jar org.productivity.java.syslog4j.server.SyslogServer -p 514 -o log1.txt -a -q udp
Run sysylogd on port 515 and log to log2.txt
# java -cp syslog4j.jar org.productivity.java.syslog4j.server.SyslogServer -p 515 -o log2.txt -a -q udp
You can run many syslogd as long as port number is different.
留言