Özel olarak faklı bir dosyaya yazılan loğları log sunucusuna göndermek için şu adımlar takip edilir.
Bu örnekte postgres pg_log dosyası içerisine kaydedilen loğları log sunucusuna gönderiyoruz.
Bu örnekler ilgili log dosyası kaynağı değiştirilerek ve etiketleme yapılarak çoğaltılabilir.
Önce konfigürasyon dosyamızı oluşturuyoruz.
vi /etc/rsyslog.d/pg_log.conf
Dosya içerisini şu şekilde düzenliyoruz.
$ModLoad imfile # Non-Syslog log file forwarding – Monday $InputFileName /postgres/9.2/data/pg_log/enterprisedb-Mon.log $InputFileTag postgres-monday $InputFileStateFile postgres-info $InputFileSeverity info $InputFileFacility local3 $InputRunFileMonitor local3.* @@11.12.13.14:514 # Non-Syslog log file forwarding – Tuesday $InputFileName /postgres/9.2/data/pg_log/enterprisedb-Tue.log $InputFileTag postgres-tuesday $InputFileStateFile postgres-info $InputFileSeverity info $InputFileFacility local3 $InputRunFileMonitor local3.* @@11.12.13.14:514 # Non-Syslog log file forwarding – Wednesday $InputFileName /postgres/9.2/data/pg_log/enterprisedb-Wed.log $InputFileTag postgres-wednesday $InputFileStateFile postgres-info $InputFileSeverity info $InputFileFacility local3 $InputRunFileMonitor local3.* @@11.12.13.14:514 # Non-Syslog log file forwarding – Thursday $InputFileName /postgres/9.2/data/pg_log/enterprisedb-Thu.log $InputFileTag postgres-thursday $InputFileStateFile postgres-info $InputFileSeverity info $InputFileFacility local3 $InputRunFileMonitor local3.* @@11.12.13.14:514 # Non-Syslog log file forwarding – Friday $InputFileName /postgres/9.2/data/pg_log/enterprisedb-Fri.log $InputFileTag postgres-friday $InputFileStateFile postgres-info $InputFileSeverity info $InputFileFacility local3 $InputRunFileMonitor local3.* @@11.12.13.14:514 # Non-Syslog log file forwarding – Saturday $InputFileName /postgres/9.2/data/pg_log/enterprisedb-Sat.log $InputFileTag postgres-saturday $InputFileStateFile postgres-info $InputFileSeverity info $InputFileFacility local3 $InputRunFileMonitor local3.* @@11.12.13.14:514 # Non-Syslog log file forwarding – Sunday $InputFileName /postgres/9.2/data/pg_log/enterprisedb-Sun.log $InputFileTag postgres-sunday $InputFileStateFile postgres-info $InputFileSeverity info $InputFileFacility local3 $InputRunFileMonitor local3.* @@11.12.13.14:514
Daha sonra syslog servisini yeniden başlatıyoruz.
/etc/init.d/rsyslog restart
Bu arada syslog sunucusuna 514 portu üzerinden erişebiliyor olmamız gerekiyor.
11.12.13.14 ip’si syslog sunucusu olarak anlaşılmalı.