- 论坛徽章:
- 7
|
一:基本概念
1: 软件包 syslogd
2: /etc/syslog.conf 配置文件
格式:facility.level action
(设备. 优先级 动作)
2.1 facility 如下:
auth -用户授权
authpriv -授权和安全
cron -计划任务:at ,cron
daemon -系统守护进程
kern -与内核有关系的信息
lpr -与打印服务有关的信息。
mail -与电子邮件有关的信息
news -来自新闻服务器的信息
syslog -由 syslog 生成的信息
user -用户的程序生成的信息,默认。
uucp -由 uucp 生成的信息
local0-local7 -来定义本地策略
2.2 level
level定义消息的紧急程度。按严重程度由高到低顺序排列为:emerg =panic(该系统不可用)
alert -需要立即采取的动作
crit -临界状态
err -错误状态。等同error
warning -预警信息,等同warn
notice -正常但是要注意
info -正常消息
debug -调试
none -一般的信息
2.3 动作
2.3.1指定日志文件的绝对路径
2.3.2 *(所有用户)
2.3.3 指定用户
2.3.4 @hostanme 或IP
2.4 配置文件详细内容如下:
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
kern.* /dev/console
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
3:日志服务的进程和服务
3.1 服务名 syslog
3.2 进程 syslogd
3.3 重读配置文件 service syslog 或 /usr/bin/killall –HUP syslogd
4:相关日志文件路径
/var/log/*.*
二:日志服务器端的配置
1:修改配置文件/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=" -x -m 0" 修改为 SYSLOGD_OPTIONS="-r -x -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".
2:修改文件syslog 之后
2.1 重启syslog服务
Service syslog restart
2.2 查看syslogd进程
ps –ef |grep syslogd |grep –v “grep syslogd”
root 30307 1 0 13:59 ? 00:00:00 syslogd -r -x -m ###有-r 就表示成功。
2.3 查看日志服务器监听的udp端口:514
netstat -untl |grep 514
udp 0 0 0.0.0.0:514 0.0.0.0:* ###514 已经起来
三:客户端的配置
1:修改/etc/syslog.conf
*.* @日志服务器的主机名或IP地址
2:重启客户端syslog
Service syslog restat
3:客户端产生的所有的日志文件将在日志服务器的/var/log/*.* 生成。
*********************完**********************
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/94782/showart_1968806.html |
|