Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

33.9. Logging

		
log on
		
		

33.9.1. log http

			
Array(config)#log http squid novip nohost
			
			

Apache Log combined Format

			
Array(config)#log http combined novip nohost
			
			

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

33.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"
			
			

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