顯示具有 embedded 標籤的文章。 顯示所有文章
顯示具有 embedded 標籤的文章。 顯示所有文章

2020年4月29日

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. 





One simple way is to run multiple syslogd with different port number, and log to different log file. So each device has its own log file. 
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 out

protocol     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. 


2010年5月5日

Use mutt receive email

如果要用mutt內建的pop/imap收信功能, 首先要檢查是否compile時有enable
# mutt -v
+USE_POP  +USE_IMAP
1. 執行mutt
2. 假設要連線到pop3 server:www.hibox.hinet.net
3. 按c 改變mail box 路徑
4. 輸入: pop://email-account@www.hibox.hinet.net 
5. 若要使用imap, 則改變pop成imap即可imap://email-account@www.hibox.hinet.net

2010年1月16日

a small and nice ini parser -- iniParser

Today I finished cross-compiling wvdial package. After I cross-compiling it, I found that it has some problem to load the wvdial.conf. And I also know that passing arguments to the wvdial is still working. Finally, I decide to modify the wvdial program to load the wvdial.conf by my own. I load the config file with iniParser and pass it to the cfg object. Now it works perfectly !!

wvdial -- a utility that helps in making modem-based connections to the Internet
wvdial site
wvdial wiki
iniParser home
wvdial introduction 

coap-client 4.3.0 Windows build

coap-client  is a  wget -like tool to generate simple requests for retrieval and modification of resources on a remote server.  Got the sour...