หน้าเว็บ

วันอังคารที่ 26 พฤศจิกายน พ.ศ. 2562

Ubuntu : Ubuntu 18.04 ส่ง log apace2 ไปเก็บที่ Log Server

Ubuntu : Ubuntu 18.04 ส่ง log apace2 ไปเก็บที่ Log Server
Ubuntu 18.04 Server มีการลง rsyslog มาให้อยู่แล้ว แก้แค่ Config

1. rsyslog.conf
  1. nano /etc/rsyslog.conf
แก้
#module(load="imudp")
#input(type="imudp" port="514")
ลบ # ออก
module(load="imudp")
input(type="imudp" port="514")

2. เพิ่ม ไฟล์ log ที่เราจะส่งไปเก็บ เช่น access.log, error.log, other_vhosts_access.log เป็นต้น
# Apache access file:

$ModLoad imfile
$InputFileName /var/log/apache2/access.log
$InputFileTag apache-access:
$InputFileStateFile stat-apache-access
$InputFileSeverity info
$InputRunFileMonitor

#Apache Error file:

$ModLoad imfile
$InputFileName /var/log/apache2/error.log
$InputFileTag apache-errors:
$InputFileStateFile stat-apache-error
$InputFileSeverity error
$InputRunFileMonitor
#Apache Other file;
$ModLoad imfile
$InputFileName /var/log/apache2/other_vhosts_access.log
$InputFileTag apache-other:
$InputFileStateFile stat-apache-other
$InputFileSeverity info
$InputRunFileMonitor

$InputFilePollInterval 10

if $programname == 'apache-access' then @@192.168.2.108:514
& ~
if $programname == 'apache-errors' then @@192.168.2.108:514
& ~
if $programname == 'apache-other' then @@192.168.2.108:514
& ~

# Forward syslog messages to Loggly
*.* @@192.168.2.108:514


ไม่มีความคิดเห็น:

แสดงความคิดเห็น