Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | Github | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

32.9. Logging

		
log on
		
		

32.9.1. log http

			
Array(config)#log http squid novip nohost
			
			

Apache Log combined Format

			
Array(config)#log http combined novip nohost
			
			

32.9.2. show log config

Array(config)#show log config
Logging is on
Logging Facility: LOCAL0
Logging source port: 514
Logging level: info
Logging option level information is off
Logging option logid is off
Logging timestamp is on
log http squid
			

32.9.3. show log buff

			
show log buff backward
show log buff backward
			
			
			
Array(config)#show log buff forward
start of buffer
INFO    Jan 11 22:41:23 CLI: User "array" executed cmd "log on"
INFO    Jan 11 22:41:30 CLI: User "array" executed cmd "show log config"
INFO    Jan 11 22:43:00 CLI: User "array" executed cmd "show log buff backward"
INFO    Jan 11 22:43:15 CLI: User "array" executed cmd "show log buff backward"
INFO    Jan 11 22:43:27 CLI: User "array" executed cmd "show log buff backward"
			
			

32.9.4. log host

			
Array(config)#log facility LOCAL1
Array(config)#log host 172.16.0.9
			
			

linux syslogd

/etc/syslog.conf

local1.*          /var/log/array.log
			

/var/log/array.log

# cat /var/log/array.log
Jan 12 00:29:29 192.168.3.20 CLI: User "array" executed cmd "show run"
			

防止日志文件本修改,加入某些属性。

1:chattr 命令可以使某个文件属性改变
     chattr  +a /var/log/array.log   只允许追加,不允许减少。
     chattr  -a /var/log/array.log   去掉属性。
2:lsattr 命令查看chattr属性
# lsattr /var/log/array.log
-----a------- /var/log/array.log