log4j and %HOSTNAME% not cooperating

This is the place for you, if you got rsyslog up and running but wonder how to make it do what you want.

Moderator: rgerhards

log4j and %HOSTNAME% not cooperating

Postby jimb » Mon Dec 15, 2008 7:51 pm

I've got a tomcat server with individual webapps setup to use a syslogAppender to send their logs over syslog to a host I have running rsyslog.

log4j.properties (trimmed) from the sending server
Code: Select all
# log to syslog
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.Threshold=DEBUG
log4j.appender.SYSLOG.syslogHost=syslog.ourdomain.tld
log4j.appender.SYSLOG.Facility=local5
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%d [%t] %-5p %c - %m%n


rsyslog.conf (trimmed) from the recieving server
Code: Select all
# Using local5 for tomcat
$template Dyntomcat, "/var/log/rsyslog/%HOSTNAME%/tomcat.log"
local5.* ?Dyntomcat


The version of rsyslog is the one available via redhat's upstream packages: rsyslog-2.0.0-11.el5

Here's my problem... sometimes it works, sometimes the %HOSTNAME% field cannot be determined and instead I just get a new directory named after whatever showed up first in the log line. e.g. /var/log/rsyslog/2008-12-15/tomcat.log

The wierd thing is, its not all or nothing. If I load my webapp and submit bogus info to a form so that I know it will cause an error I get *some* lines in /var/log/rsyslog/myhostsname/tomcat.log and *some* lines in /var/log/rsyslog/whateverstringcamefirst/tomcat.log

Is this a log4j bug for not putting the hostname in the log line? A configuration error on my part? A known issue with this older version of rsyslog?
jimb
New
 
Posts: 1
Joined: Mon Dec 15, 2008 7:34 pm

Professional Services Information

  • Custom written rsyslog.conf?
  • Maintenance Contract?
  • Installation support?

Re: log4j and %HOSTNAME% not cooperating

Postby rgerhards » Mon Dec 15, 2008 7:52 pm

please let it run in debug mode and post or mail the output. It may be lengthy...
User avatar
rgerhards
Site Admin
 
Posts: 2778
Joined: Thu Feb 13, 2003 11:57 am

Google Ads



Return to Configuration

Who is online

Users browsing this forum: No registered users and 0 guests

cron