I need to push JIRA logs (tomcat logs) to remote syslog server.
Hi Heshan,
Try to use syslog appender. In log4j properties you add it and then you have to insert DNS SERVER NAME.... :)
It would be great if you could provide more information regarding enabling syslog appender.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you know how can i add hostname/ip address on each syslog line from jira application log?
Following is my log4j confg:
log4j.rootLogger=WARN, filelog, SYSLOG
log4j.appender.SYSLOG.threshold=WARN
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.syslogHost=127.0.0.1
log4j.appender.SYSLOG.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%t %5r %-5p %-21d{yyyyMMdd HH:mm:ss,SSS} %c{2} [%x] %m %throwable{none}
log4j.appender.SYSLOG.Facility=local0
Above config +dns config is generating following logs but missing the hostname. I have copied 3 syslog lines in here.
Nov 15 14:19:10 http-nio-8080-exec-2950 1096259174 WARN 20191115 14:19:10,743 runner.AbstractScriptRunner [null] Hello this is a test log message
Nov 15 14:19:10 http-nio-8080-exec-2950 1096259174 WARN 20191115 14:19:10,743 runner.AbstractScriptRunner [null] Hello this is a test log message
Nov 15 14:19:10 http-nio-8080-exec-2950 1096259174 WARN 20191115 14:19:10,743 runner.AbstractScriptRunner [null] Hello this is a test log message
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to modify log4j.property file.
Add SYSLOG to log4j.rootCategory.
Ex:
# sample properties to initialize
log4j log4j.rootCategory= WARN, console, filelog, SYSLOG, fout
Then add below appender to this file
log4j.appender.SYSLOG.threshold=WARN
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.syslogHost=<IP address of local syslog server>
log4j.appender.SYSLOG.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%t %5r %-5p %-21d{yyyyMMdd HH:mm:ss,SSS} %c{2} [%x] %m %throwable{none}
log4j.appender.SYSLOG.Facility=LOCAL0
Then go to /etc/syslog-ng/syslog-ng.conf file
Un-comment below line udp(ip("0.0.0.0") port(514));
and add below lines
destination df_remote_log { udp("<IP address of remote syslog server>" port(514)); };
filter f_mit { facility(LOCAL0); };
log {
source(src);
filter(f_mit); destination(df_remote_log);
};
Finally restart tomcat and syslog services
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Heshan,
can you please let me know how to add hostname on each syslog line? I have followed the instruction but we don't get hostname/ source ip address.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Today only! Share what you’re the most excited about for Team ‘25 or just dance out the beginning of a new quarter with us.
Comment the postOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.