美文网首页
Syslog系统日志配置

Syslog系统日志配置

作者: Lano_chazz | 来源:发表于2018-02-27 16:54 被阅读0次

linux系统会默认在/var/log产生多种日志,具体的配置信息在/etc/rsyslog.conf中:

# rsyslog configuration file

# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html

#### MODULES ####

# The imjournal module bellow is now used as a message source instead of imuxsock.
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
#$ModLoad imklog # reads kernel messages (the same are read from journald)
#$ModLoad immark  # provides --MARK-- message capability

# Provides UDP syslog reception
#$ModLoad imudp
#$UDPServerRun 514

# Provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514


#### GLOBAL DIRECTIVES ####

# Where to place auxiliary files
$WorkDirectory /var/lib/rsyslog

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

# Turn off message reception via local log socket;
# local messages are retrieved through imjournal now.
$OmitLocalLogging on

# File to store the position in the journal
$IMJournalStateFile imjournal.state


#### RULES ####

# 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                                                 :omusrmsg:*

# 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


# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
#$ActionQueueFileName fwdRule1 # unique name prefix for spool files
#$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
#$ActionQueueType LinkedList   # run asynchronously
#$ActionResumeRetryCount -1    # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
#*.* @@remote-host:514
# ### end of the forwarding rule ###

配置文件/etc/logrotate.conf: 它是logrotate的一般性配置文件。你可以通过它设置哪个日志文件被循环重用以及多久重用一次。可以设定的循环参数有每周(weekly)或每天(daily)。rotate参数定义保留多少份日志文件备份,create参数指定在每轮循环后就新建空的日志文件。

清理:
cat /dev/null > /var/log/message-...

相关文章

  • linux 日志系统

    基于Syslog 的日志系统 一、简介 syslog是Linux系统默认的日志守护进程。默认的主配置文件和辅助配置...

  • 每天一个Linux命令之syslog

    syslog是Linux系统默认的日志守护进程。默认的syslog配置文件是/etc/syslog.conf文件。...

  • linux日志系统

    软件 syslog syslog-ng(next generation) 日志系统:syslog 负责统一记录日志...

  • Syslog系统日志配置

    linux系统会默认在/var/log产生多种日志,具体的配置信息在/etc/rsyslog.conf中: 配置文...

  • 无线考勤实现

    配置华为控制器,启用 SysLog配置华为SysLog 使用 Logstash 实现日志收集 使用 Elastic...

  • syslog-ng 配置

    SERVER 配置: #syslog-ng配置服务器IP:10.29.11.37 CLIENT 配置: #推日志到...

  • rsyslog配置

    配置linux自带的syslog,使之成为日志服务器。 1.vim /etc/sysconfig/syslog S...

  • 02-monolog - PHP 日志神器 之 Handlers

    Handlers 记录日志到文件与系统日志(syslog) StreamHandler:记录日志到任何 PHP s...

  • 解决ubuntu16.04启动时SSH报错“Start oper

    近日在偶然发现系统启动时系统日志报错,路径为/var/log/syslog。 如下: Start operatio...

  • linux:日志logger命令详解

    logger是一个shell命令接口,可以通过该接口使用Syslog的系统日志模块,还可以从命令行直接向系统日志文...

网友评论

      本文标题:Syslog系统日志配置

      本文链接:https://www.haomeiwen.com/subject/vtymxftx.html