This article explains if you are submitting a tomcat log, create a stand-alone configuration for Tomcat.
Why create a stand-alone configuration file?
Modular for easy management and commissioning. If you do not need to, delete the corresponding configuration file directly.
The following is a description of the configuration, all of which are commented.
Note: Tutorial related configuration download.
The Chinese notes in the profile are easy for beginners and unofficial, and Chinese annotations can cause strange problems.
Suggestion: Delete all the Chinese comments in use, if you want to comment can be in English (really not pinyin)
Environment: Tomcat installation path/web/webfront
Vi/etc/rsyslog.d/tomcat-log.conf
# rsyslog v5 configuration file# for more information see /usr/ share/doc/rsyslog-*/rsyslog_conf.html# if you experience problems, see http:// www.rsyslog.com/doc/troubleshoot.html#### modules ####### Note that the ### #配置文件中的中文注释为方便初学者, and unofficially provided, Chinese comments can cause strange problems. #建议: Delete all the Chinese comments in use, if you want comments can be in English (not really pinyin) #装载imfile模块 $ModLoad imfile# Check the log file interval (in seconds) $InputFilePollInterval 1# The state file saves the path, and the file is used to record information such as scan log location. #在测试中服务器收集不到日志, because the scanned document is not uploaded again, you can empty the directory cache $workdirectory /var/spool/rsyslog# define the queue file name #$ actionqueuefilename relpact# Retry count, -1 means infinite retry # $ActionResumeRetryCount -1# Rsyslog the queue contents to disk when closed, preventing data loss # $ActionQueueSaveOnShutdown on$privdroptogroup root# #日志格式模板: $template biglogformattomcat, "%msg%\n" ## tomcat catalina.out path, modified according to the actual situation: #读取日志文件 $InputFileName /web/ webfront/logs/catalina.out# Write log append tag string $inputfiletag catalina-out# log type, LOCAL5 must and log collection Server filter facility (LocAL5) LOCAL5 in the same name. $InputFileFacility local5 #定义记录偏移量数据文件名 $InputFileStateFile stat-catalina-out# Log Level $ inputfileseverity info# write-back offset data to file interval (seconds) $InputFilePersistStateInterval 1# Active read, you can set up multiple sets of log reads, set this parameter at the end of each group. To take effect. $InputRunFileMonitor # When submitting logs to a different server, specify the server Ip:port here separately, #如都提交在同一服务器只需在rsyslog. conf specify one time to # local5.* @ @192.168.1.251:514## tomcat Localhost.log Path, modified according to the actual situation: $InputFileName /web/webfront/logs/localhost.log $InputFileTag catalina-log$inputfilefacility local4$inputfilestatefile stat-localhost-log$ inputfileseverity info$inputfilepersiststateinterval 1$inputrunfilemonitor# Specify the server IP here separately when submitting logs to different servers: Port, #如都提交在同一服务器只需在rsyslog. conf specify one time to #local4.* @@192.168.1.251:514## notice that the Syslog log server receives the address, According to the actual situation modified:## the following content is only used when the Rsyslog do the service, reserved for reference only. # if $programname == ' catalina-out ' then @@192.168.1.251:514; biglogformattomcat# if $programname == ' catalina-out ' then ~# if $programname == ' Localhost-log ' then @@192.168.1.251:514; biglogformattomcat# if $programname == ' Localhost-log ' then ~
This article is from the "Enlightened Grocery store" blog, please be sure to keep this source http://wutou.blog.51cto.com/615096/1765310
Syslog-ng+syslog collecting Tomcat logs (iii)