Log4j2 Syslog Appender formatting on Mac - macos

I am having an issue with log4j2's SyslogAppender on Mac (OSX 10.9.2). The default format which log4j2 is sending to syslog is causing the messages to be parsed incorrectly. My configuration:
<Syslog name="Syslog" host="localhost" port="514"
protocol="UDP" format="RFC5424" appName="MyApp" id="log4j2-test"
mdcIncludes="Priority,Logger,Exception,Message" newLine="true">
</Syslog>
When I run:
syslog -F raw
I get the following:
[ASLMessageID 1291756] [Time 1411090836] [TimeNanoSec 0] [Level 6] [PID 4294967295] [UID 4294967294] [GID 4294967294] [ReadGID 80] [Host 1] [Sender 2014-09-19T01] [Facility local0] [Message 40:36.481Z Mario.local MyApp - - - Hello, world!]
The same message without the raw formatting shows up like this:
Sep 19 09:40:36 1 2014-09-19T01[4294967295] <Info>: 40:36.481Z Mario.local MyApp - - - Hello, world!
Based on how the Date String is split between two places, it looks like log4j2 SyslogAppender uses a default format of:
%d <host> <app> - - - %m
And syslog is splitting everything incorrectly. The Sender should not be the first part of the Date String, and the Message should not be the combined rest of the message.
I cannot find a way to change SyslogAppender's format string, as adding a PatternLayout element inside is just ignored. I have also looked into the LoggerFields solution proposed here: log4j2 - Syslog appender and PatternLayout and that only complicates the Message element further without fixing the problem of having the incorrect Sender.
Does anyone know how to adjust log4j2's SyslogAppender so that it sends properly formatted messages to OSX 10.9.2's syslog?

I suggest raising this as a feature request on the log4j2 Jira issue tracker: http://logging.apache.org/log4j/2.x/issue-tracking.html

Related

Springboot parsing HTTP HTTPS

I have found such error message in my Springboot app logs:
Oct 20 14:22:14 ip-10-0-78-113 web: 2020-10-20 14:22:14.388 INFO 3802 — [nio-8081-exec-5] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header
Oct 20 14:22:14 ip-10-0-78-113 web: Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
Oct 20 14:22:14 ip-10-0-78-113 web: java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
...
I got to know, that its probably because somebody / some app is calling my endpoint with use of HTTPS instead of HTTP. I was able to log those requests by including in properties:
logging.level.org.springframework.web: trace
logging.level.org.apache: trace
Now I have received unparsed text, something like this:
Received [ ÷ ó÷=EVq&GŵH¡à}C¶vÓÂíÿ#,¾ )L /ð^ w» e<Ú5~ñ¨7ëÌaÒ*l×e $À/À+À0À,̨̩À ÀÀ
À / 5
localhost ÿ
3 & $ ¬·lä¹]Ö·a6ððòvcd»[7Ûj V - + ]
Is it possible to decode/decrypt it, and find out what the actual API call was?
I had same problem & make it working by using http:// instead of https://

Spring boot logging file name

🐞 Bug report ??
image
logging:
level:
com.zaxxer.hikari: DEBUG
org.springframework: INFO
org.kafka.test: TRACE
file: "logs/%d{yyyy-MM-dd HH_mm_ss} pid-${PID}.log"
pattern.console: "%d{HH:mm:ss} - %msg%n"
Hello.
please help with the file name.
The time format does not work well.
I expected to see 1 file named "2020-02-07 10_38_40 pid-17996.log"
I got 2 files and the file names are bad.
Please do not advise using logback-spring.xml
I configure logs through .yml

How to monetdb log settings (merovingian.log)

How to MonetDB log settings.
I want to change the log level of "merovingian.log".
I want to output the ERROR and WARN the merovingian.log.
But now merovingian.log is outputting only MSG log.
2016-07-22 18:12:03 MSG merovingian[7825]: proxying client x.x.x.x:51609 for database 'test' to mapi:monetdb:///var/MonetDB/dbfarm/test/.mapi.sock?database=test
2016-07-22 18:12:03 MSG merovingian[7825]: target connection is on local UNIX domain socket, passing on filedescriptor instead of proxying
OS is "CentOS 6.4",
MonetDB version is "MonetDB-11.19.7".
Any advice how to solve this problem?
No fine-tuning is provided in where log information ends up.

Logstash stuck when starting up

What's wrong with the following logstash configuration?
input {
file {
type => "access_log"
# Wildcards work, here :)
path => [ "/root/isaac/my_logs/access_logs/gw_access_log*"]
start_position => "beginning"
}
}
output {
stdout { debug => true }
elasticsearch { embedded => true }
}
When running the above configuration, logstash is stuck on startup as follows:
[root#myvm logstash]# java -jar logstash-1.3.3-flatjar.jar agent -f logstash-complex.conf
Using milestone 2 input plugin 'file'. This plugin should be stable, but if you see strange behavior, please let us know! For more information on plugin milestones, see http://logstash.net/docs/1.3.3/plugin-milestones {:level=>:warn}
More importantly what are the ways to debug the issue?
I already checked that the file i am putting in the path do exist.
That isn't stuck, that's running.
you get this:
Using milestone 2 input plugin 'file'. This plugin should be stable, but if you see strange behavior, please let us know! For more information on plugin milestones, see http://logstash.net/docs/1.3.3/plugin-milestones {:level=>:warn}
Once logstash has started successfully
If you add -- web onto the end of your command then you should be able to see some output in Kibana web interface
If you aren't seeing messages appear in the console, first I would check that new entries are definitely being written to the file(s) that you're trying to tail. Since you're using the stdout output you should see the messages written to the console at the same time as they're going into the embedded Elasticsearch.
What I would suggest is you simplify your config by removing the elasticsearch output - this should speed up the startup time (it can take a minute or two for the embedded elasticsearch instance to start up) and focus on getting messages onto the console output first.
If you do want more verbose debug output from Logstash you can start the program with -v, -vv or -vvv for progressively more detailed debug information. E.g.:
java -jar logstash-1.3.3-flatjar.jar agent -f logstash-complex.conf -vvv
Fair warning that -vvv does produce a LOT of debug information, so start with -v and work your way up.

How can I disable console messages when running maven commands?

I'm in the process of executing Maven commands to run tests in the console (MacOSX). Recently, development efforts have produced extraneous messages in the console (info, debug, warning, etc.) I'd like to know how to remove messages like this:
INFO c.c.m.s.c.p.ApplicationProperties - Loading application properties from: app-config/shiro.properties
I've used this code to remove messages from the dbunit tests:
ch.qos.logback.classic.Logger Logger = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger("org.dbunit");
Logger.setLevel(Level. ERROR);
However, I'm unsure how to disable these additional (often verbose and irritating) messages from showing up on the console so that I can see the output more easily. Additional messages appear as above and these:
DEBUG c.c.m.s.c.f.dao.AbstractDBDAO - Adding filters to the Main Search query.
WARN c.c.m.s.c.p.JNDIConfigurationProperties - Unable to find JNDI value for name: xxxxx
INFO c.c.m.a.t.d.DatabaseTestFixture - * executing sql: xxxxx
The successful answer was:
SOLUTION: Solution to issue IS adding a 'logback-test.xml' file to the root of my test folder. I used the default contents (as instructed by the documentation - thanks #Charlie). Once file exists there, FIXED!

Resources