I am facing two issues when I am LOGGING the LOG MESSAGES in JSON FORMAT under logstash node through rsyslog node . jboss logging flow is like this. JBOSS SERVER------>RSYSLOG------->LOGSTASH FIRST ISSUE:How to use the thowable logging pattern in jboss EAP 6.4. you can refer the https://docs.jboss.org/jbossas/javadoc/7.1.2.Final/org/apache/log4j/EnhancedPatternLayout.htmllink. throwableUsed to output the Throwable trace that has been bound to the LoggingEvent, by default this will output the full trace as one would normally find by a call to Throwable.printStackTrace(). %throwable{short} or %throwable{1} will output the first line of stack trace. throwable{none} or throwable{0} will suppress the stack trace. %throwable{n} will output n lines of stack trace if a positive integer or omit the last -n lines if a negative integer. If no %throwable pattern is specified, the appender will take responsibility to output the stack trace as it sees fit.
I have tried "throwbale" pattern like below under JBOSS EAP 6.4: this configuration took from standalone.xml standalone.xml <custom-handler name="RSYSLOG" class="org.jboss.logmanager.handlers.SyslogHandler" module="org.jboss.logmanager"> <encoding value="ISO-8859-1"/> <formatter> <pattern-formatter pattern="{ "thread_name":"%t", "thread_id":"%t", "class_name":"%C", "src_file":"%F", "line_no":"%L", "message":"%m", "throwable":%throwable{short}", "msg_type":"log4j2"}%n"/> </formatter> <properties> <property name="appName" value="MY_APP"/> <property name="facility" value="LOCAL_USE_4"/> <property name="serverHostname" value="localhost"/> <property name="hostname" value="localhost"/> <property name="port" value="514"/> <property name="syslogType" value="RFC3164"/> <property name="protocol" value="TCP"/> <property name="messageDelimiter" value=":"/> <property name="useMessageDelimiter" value="false"/> <property name="escapeEnabled" value="true"/> </properties> </custom-handler>
I did not find any example in internet for throwbale logging pattern. SECOND ISSUE:I am sending message in json format from JBOSS SERVER to LOGSTASH node through RSYSLOG. Issue: As the messsages are in json format, they are failed to be parsed by the json parser at logstash node and Hence they are not logging under /var/log/logging/app.log directory of logstash node. I have tried escapeEnabled =true configiuration. see the above configuration for this.Still it is not working. observations: Messages having special characters like "",:,'' ,().Especially these kind of messsages are failing and NOT logging under logstash node. can somebody help me how to ESCAPE THE SPECIAL CHARACTERS in the the messages in THROUGH JBOSS LOGGING FORMAT.So that logs will be logged under logtstash node and we can avoid json parsing as well. Thanks. Raja |