linux 日志服务器简单用
生活随笔
收集整理的這篇文章主要介紹了
linux 日志服务器简单用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
利用LINUX 系統日志功能來充當LOG SERVER,/etc/syslog.conf是配置文件,里面定義了一些服務與日志路徑,?SSH下用vi /etc/sysconfig/syslog,打開看到內容如下: # Options to syslogd
# -m 0 disables 'MARK' messages.
# -r enables logging from remote machines
# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
SYSLOGD_OPTIONS="-m 0"
# Options to klogd
# -2 prints all kernel oops messages twice; once for klogd to decode, and
#??? once for processing with 'ksymoops'
# -x disables all klogd processing of oops messages entirely
# See klogd(8) for more details
KLOGD_OPTIONS="-x"
#
SYSLOG_UMASK=077
# set this to a umask value to use for all log files as in umask(1).
# By default, all permissions are removed for "group" and "other". SYSLOG_OPTIONS的參數默認是"-m 0"這樣應該是只記錄本機的日志,上面有一個參數-r(remote),添加成“-rm 0"之后為: SYSLOGD_OPTIONS="-rm 0" 這是一個服務,你可以用/etc/init.d/syslog restart 重啟, 你就可以把遠程的網絡設備什么的日志放到這個機器上了,只不過它放在/VAR/LOG/MESSAGES文件中,要想自定義其路徑及文件需要修改/etc/syslog.conf文件,在文件尾添加 local0.*??? /var/log/router.log local0-local7? 為用戶可以自己定義使用 的、 我用思科的? ? ? NAV10-WF-ADVSEC的日志記錄到遠程機器的功能測試 一秒之后 CAT /VAR/LOG/MESSAGES文件。 將會看到一些有關思科的NAV的日志記錄。 Nov 17 13:07:01 192.168.1.1 Router kernel: KERN_INFO [IPS] (eth0)(4094) Hit rule-name: P2P QQLive UDP attempt, source ip: 119.147.18.173 action: drop
Nov 17 13:07:40 192.168.1.1 last message repeated 3 times
Nov 17 13:08:45 192.168.1.1 last message repeated 6 times
Nov 17 13:09:04 192.168.1.1 last message repeated 2 times
Nov 17 13:09:11 192.168.1.1 Router kernel: KERN_INFO [IPS] (eth0)(4094) Hit rule-name: Possible DoS HGOD SynKiller Flooding, source ip: 61.191.191.151 action: drop, block/reset
Nov 17 13:09:13 192.168.1.1 Router kernel: KERN_INFO [IPS] (eth0)(4094) Hit rule-name: P2P QQLive UDP attempt, source ip: 119.147.18.173 action: drop
Nov 17 13:09:52 192.168.1.1 last message repeated 4 times
Nov 17 13:11:00 192.168.1.1 last message repeated 7 times
Nov 17 13:12:08 192.168.1.1 last message repeated 7 times syslog 的遠程日志要用到UDP 514端口號,如果你用IPTABLES ,那就打開這個端口
? iptables -A INPUT -p udp -i? 'yourethif '?????-s? '設備的IP'?-d?? ??'linux主機'???--sport 514 -j ACCEPT
? 比較簡單,別扔石頭。。。。
?
# -m 0 disables 'MARK' messages.
# -r enables logging from remote machines
# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
SYSLOGD_OPTIONS="-m 0"
# Options to klogd
# -2 prints all kernel oops messages twice; once for klogd to decode, and
#??? once for processing with 'ksymoops'
# -x disables all klogd processing of oops messages entirely
# See klogd(8) for more details
KLOGD_OPTIONS="-x"
#
SYSLOG_UMASK=077
# set this to a umask value to use for all log files as in umask(1).
# By default, all permissions are removed for "group" and "other". SYSLOG_OPTIONS的參數默認是"-m 0"這樣應該是只記錄本機的日志,上面有一個參數-r(remote),添加成“-rm 0"之后為: SYSLOGD_OPTIONS="-rm 0" 這是一個服務,你可以用/etc/init.d/syslog restart 重啟, 你就可以把遠程的網絡設備什么的日志放到這個機器上了,只不過它放在/VAR/LOG/MESSAGES文件中,要想自定義其路徑及文件需要修改/etc/syslog.conf文件,在文件尾添加 local0.*??? /var/log/router.log local0-local7? 為用戶可以自己定義使用 的、 我用思科的? ? ? NAV10-WF-ADVSEC的日志記錄到遠程機器的功能測試 一秒之后 CAT /VAR/LOG/MESSAGES文件。 將會看到一些有關思科的NAV的日志記錄。 Nov 17 13:07:01 192.168.1.1 Router kernel: KERN_INFO [IPS] (eth0)(4094) Hit rule-name: P2P QQLive UDP attempt, source ip: 119.147.18.173 action: drop
Nov 17 13:07:40 192.168.1.1 last message repeated 3 times
Nov 17 13:08:45 192.168.1.1 last message repeated 6 times
Nov 17 13:09:04 192.168.1.1 last message repeated 2 times
Nov 17 13:09:11 192.168.1.1 Router kernel: KERN_INFO [IPS] (eth0)(4094) Hit rule-name: Possible DoS HGOD SynKiller Flooding, source ip: 61.191.191.151 action: drop, block/reset
Nov 17 13:09:13 192.168.1.1 Router kernel: KERN_INFO [IPS] (eth0)(4094) Hit rule-name: P2P QQLive UDP attempt, source ip: 119.147.18.173 action: drop
Nov 17 13:09:52 192.168.1.1 last message repeated 4 times
Nov 17 13:11:00 192.168.1.1 last message repeated 7 times
Nov 17 13:12:08 192.168.1.1 last message repeated 7 times syslog 的遠程日志要用到UDP 514端口號,如果你用IPTABLES ,那就打開這個端口
? iptables -A INPUT -p udp -i? 'yourethif '?????-s? '設備的IP'?-d?? ??'linux主機'???--sport 514 -j ACCEPT
? 比較簡單,別扔石頭。。。。
?
轉載于:https://blog.51cto.com/ivruru/228697
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的linux 日志服务器简单用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: silverlight中如何将strin
- 下一篇: linux 其他常用命令