/**********************************************************************************
* Linux syslogd
* 说明:
* 今天检查一下系统的系统日志,看一下系统是否正常,之前也都没有查看过这部分
* 日志。
*
* 2017-2-22 深圳 南山平山村 曾剑锋
********************************************************************************/
一、参考文档:
1. 30.11. 使用 syslogd 记录远程主机的日志
https://www.freebsd.org/doc/zh_CN/books/handbook/network-syslogd.html
二、syslogd帮助:
# syslogd --help
BusyBox v1.25.1 (2017-01-16 18:39:57 CST) multi-call binary.
Usage: syslogd [OPTIONS]
System logging utility
(this version of syslogd ignores /etc/syslog.conf)
-n Run in foreground
-R HOST[:PORT] Log to HOST:PORT (default PORT:514)
-L Log locally and via network (default is network only if -R)
-O FILE Log to FILE (default: /var/log/messages, stdout if -)
-s SIZE Max size (KB) before rotation (default:200KB, 0=off)
-b N N rotated logs to keep (default:1, max=99, 0=purge)
-l N Log only messages more urgent than prio N (1-8)
-S Smaller output
#
三、/var/log/messages示例:
...
Feb 21 00:39:34 aplex user.debug kernel: usb 2-1: usb auto-suspend
Feb 21 00:39:34 aplex user.info kernel: eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=1:01, irq=-1)
Feb 21 00:39:36 aplex user.debug kernel: hub 2-0:1.0: hub_suspend
Feb 21 00:39:36 aplex user.debug kernel: usb usb2: bus auto-suspend
Feb 21 00:39:36 aplex user.debug kernel: ehci_fsl_bus_suspend begins, Host 1
Feb 21 00:39:36 aplex user.debug kernel: fsl-ehci fsl-ehci.1: suspend root hub
Feb 21 00:39:36 aplex user.debug kernel: ehci_fsl_bus_suspend ends, Host 1
Feb 21 00:39:37 aplex user.info kernel: PHY: 1:01 - Link is Up - 100/Full
Feb 21 00:39:38 aplex auth.info sshd[1478]: Server listening on 0.0.0.0 port 22.
Feb 21 00:39:38 aplex daemon.err tftpd[1494]: cannot open IPv6 socket, disable IPv6: Address family not supported by protocol
Feb 21 00:39:38 aplex daemon.err tftpd[1494]: Cannot set nonblock flag on socket: Bad file descriptor
Feb 21 00:39:41 aplex daemon.info : starting pid 1641, tty '/dev/ttymxc0': '/sbin/getty -L ttymxc0 115200 vt100 '
Feb 22 22:05:26 aplex auth.info sshd[6989]: Accepted password for root from 192.168.10.10 port 49136 ssh2
...