请教一下rsyslog.conf这样写合适吗

a82926525 2018-01-27 05:27:21
工作需要一个日志服务器,己经搭建好了,LINUX的日志也能过去了,但感觉不是很全,想请教一下各位前辈,这个配置里面有什么地方需要修改的吗?比如我需要所有的日志都过去日志服务器那边,还有设置日志服务器后,平时产生的日志会一直占用LINUX服务器的空间吗?
# rsyslog v5 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 ####

$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
#$ModLoad immark # provides --MARK-- message capability

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

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


#### GLOBAL DIRECTIVES ####

# 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


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

# 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.
#$WorkDirectory /var/lib/rsyslog # where to place spool files
#$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
*.* @192.168.0.106:514
# ### end of the forwarding rule ###

# A template to for higher precision timestamps + severity logging
$template SpiceTmpl,"%TIMESTAMP%.%TIMESTAMP:::date-subseconds% %syslogtag% %syslogseverity-text%:%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"

:programname, startswith, "spice-vdagent" /var/log/spice-vdagent.log;SpiceTmpl
...全文
471 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
a82926525 2018-01-30
  • 打赏
  • 举报
回复
引用 3 楼 ckc 的回复:
别说rsyslog,syslog用的人都不对,对它了解很清楚的人就更少了 这个问题还是自己认真检查一下比较好,其实也不难吧,总共就那几个日志,一个一个检查是不是过去了也要不了多少时间
感谢楼上的各位回复,谢谢,那我结帖了
ckc 2018-01-30
  • 打赏
  • 举报
回复
别说rsyslog,syslog用的人都不对,对它了解很清楚的人就更少了 这个问题还是自己认真检查一下比较好,其实也不难吧,总共就那几个日志,一个一个检查是不是过去了也要不了多少时间
a82926525 2018-01-29
  • 打赏
  • 举报
回复
引用 1 楼 qq_36751214 的回复:
可以从crond搞个脚本定期删除....
这个知道,我想问一下,就我上面的那个conf文件,里面是linux所有的日志都会过去了吗?
宁南学者 2018-01-29
  • 打赏
  • 举报
回复
可以从crond搞个脚本定期删除....

18,773

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 专题技术讨论区
社区管理员
  • 专题技术讨论区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧