SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы

Список вопросов Печать

Настройка сервера централизованного сбора логов


Метки: rsyslog логирование 

Ответы

RemiZOffAlex  Создано: 2018-10-23 13:56:49.069376  Обновлено: 2018-10-23 13:56:49.069376

Файл /etc/rsyslog.d/remotes.conf

$template RemoteHost, "/var/log/remotes/%fromhost-ip%/%$YEAR%/%$MONTH%/%$DAY%.log"

$RuleSet remote
*.* ?RemoteHost
$InputUDPServerBindRuleset remote
$UDPServerRun 514

Файл /etc/sysconfig/rsyslog

SYSLOGD_OPTIONS="-x"

Файл /etc/rsyslog.conf

# rsyslog configuration file
#### MODULES ####
$ModLoad imuxsock
$ModLoad imjournal
#$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

$CreateDirs on

#### RULES ####
$RuleSet local
# 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
$DefaultRuleset local

Возможно будут интересны и другие вопросы