Tomcat catalina.outログ

シナリオは下記の通りです。

クライアントのアプリケーションログを“PLURA V5 Log Collectorサーバー”を使用して転送する方法

 アプリケーションログの中、この例ではTomcat8のcatalina.outを使用します。

 PLURA Log Collectorサーバー使用の利点はクライアント(Web Server)に別のログを生成せずにsyslogにすぐ転送するので、リソース使用量
 (CPU、メモリなど)を最小限に抑えることができます。 

1. クライアント: Tomcat8のcatalina.out

環境: CentOS 6 (64ビット), Rsyslog 5.8.10

1-1. rsyslog.confダウンロード

# curl -s https://repo.plura.io/v5/module/rsyslog/v5-stable/00-imfile.conf -o /etc/rsyslog.d/00-imfile.conf

# curl -s https://repo.plura.io/v5/module/rsyslog/v5-stable/80-tomcat.conf -o /etc/rsyslog.d/80-tomcat.conf

1-2. rsyslog.conf remote rsyslogサーバーに転送修正

# vi /etc/rsyslog.d/80-tomcat.conf

#variables required for non-syslog log file forwarding – application log file
 #edit on your location

 $InputFileName /var/log/tomcat8/catalina.out
 $InputFileTag tomcat8:
 $InputFileStateFile stat-catalina.out

 $InputFileSeverity info
 $InputFileFacility local7
 $InputRunFileMonitor

 # Send to remote rsyslog server using UDP
 if $programname == ‘tomcat8’ then @PLURA_Log_Collector_Server:514 #UDP
 :programname, isequal, “tomcat8” ~

1-3. rsyslog restart

# service rsyslog restart

1-4. サーバー接続debug

# nc -zu PLURA_Log_Collector_Server 514

Connection to PLURA_Log_Collector_Server 514 port [udp/syslog] succeeded!

2. サーバー

환경 : CentOS 7, Rsyslog 8.2010.0

2-2. Remote クライアントのsyslog転送オープン

# firewall-cmd –add-port 514/udp

# firewall-cmd –reload

2-3. パスにファイル受信可否確認

# ls -al /var/log/plura/

内部ブログ

https://docs.plura.io/ja/agents/siem/uplc/application-log-plc

外部参考サイト

https://www.rsyslog.com/doc/v5-stable/configuration/modules/imfile.html

https://www.rsyslog.com/doc/v8-stable/configuration/modules/imfile.html

http://linuxsysconfig.com/how-to-configure-remote-logging-on-rhel6-centos6/

https://www.teimouri.net/centralized-logs-rsyslog/

Last updated