티스토리 뷰

linux

rsyslog server setup on centos7

fendys 2021. 4. 10. 22:22
반응형

1. rsyslog server install & setup

#yum instll rsyslog

#vi /etc/rsysog.conf

#################################아래 항목 주석 제거#################################
# 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
#################################주석 제거 end##############################



#################################rule set 추가#################################
### 필요 경로에 경로에 호스트네임_년_월_일.log 성
$template FILENAME,"/data/syslog//%hostname%/%hostname%_%$YEAR%-%$MONTH%-%$DAY%.log"
*.* ?FILENAME
#################################rule set end#################################

 

2. rsyslog 재기동

#systemctl restart rsyslog

 

3. rsyslog 상태 확인

systemctl status rsyslog

 

3. client setuo

vi /etc/rsyslog.d/remote.conf
아래 내용추가
## @@rsyslogserverIP:514 / @ - UDP /@@ - TCP
################################# remote log set #################################
*.* @@xxx.xxx.xxx.xxx:514
#################################rule set end#################################

 

반응형