免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 800 | 回复: 0
打印 上一主题 下一主题

初学者:Linux日志服务器 [复制链接]

论坛徽章:
7
天蝎座
日期:2013-08-16 23:19:32丑牛
日期:2014-01-08 09:20:14寅虎
日期:2014-01-11 11:03:44午马
日期:2014-04-28 11:02:40天秤座
日期:2014-05-16 23:24:24摩羯座
日期:2014-07-20 10:46:04卯兔
日期:2014-08-08 15:21:41
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-18 15:28 |只看该作者 |倒序浏览

一:基本概念
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
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP