Posts

Showing posts with the label Log

Centralized Log ภาคที่ 3 : Syslog-NG

1.ติดตั้ง Syslog-NG ที่ Log Server และ Server อื่น ๆ ที่เป็น linux apt-get install syslog-ng 2.Config Log Server (/etc/syslog-ng/syslog-ng.conf) options { recv_time_zone (+07:00); send_time_zone (+07:00); sync (0); time_reopen (100); log_fifo_size (1000); long_hostnames (off); use_dns (no); use_fqdn (no); create_dirs (yes); chain_hostnames(yes); keep_hostname (yes); }; source s_sys { file ("/proc/kmsg" log_prefix("kernel: ")); unix-stream ("/dev/log"); internal(); #udp(ip(0.0.0.0) port(514)); #tcp(ip(0.0.0.0) port(514) keep-alive(yes)); }; destination d_mysql { pipe("/var/log/mysql.pipe" template("INSERT INTO logs (host, facility, priority, level, tag, datetime, program, msg) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC', '$PROGRAM', '$MSG' );\n") template-escape(yes)); }; filter f_filter1 { facility (kern); }; filter f_f...

Centralized Log ภาคที่ 1 : NTP

ติดตั้ง NTP (Network Time Protocol) ตาม พรบ.ว่าด้วยการกระทำผิดเกี่ยวกับคอมพิวเตอร์ พ.ศ. 2550 กำหนดให้ ต้องตั้งนาฬิกาของอุปกรณ์บริการทุกชนิดให้ตรงกับเวลาอ้างอิงสากล (Stratum 0) โดยผิดพลาดไม่เกิน 10 มิลลิวินาที 1.ติดตั้ง apt-get install ntp (ที่ Log Server และ Server อื่น ๆ) 2.ตั้งค่า Log Server ( /etc/ntp.conf ) # /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help driftfile /var/lib/ntp/ntp.drift # Enable this if you want statistics to be logged. #statsdir /var/log/ntpstats/ #statistics loopstats peerstats clockstats #filegen loopstats file loopstats type day enable #filegen peerstats file peerstats type day enable #filegen clockstats file clockstats type day enable # You do need to talk to an NTP server or two (or three). server 203.185.69.60 dynamic server time.navy.mi.th dynamic server time.nist.gov dynamic server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 broadcastdelay 0.008 keys /etc/ntp/keys # Access control configuration; see /usr/share/doc/ntp-doc/html/...