Logstash: in log4j-input, the “path” is not correct

In my config file, I use

input { log4j {} }
output { stdout { codec => rubydebug } }

I've attached my log4j to logstash using SocketListener. When my app prints something to the log, I see in logstash:

"message" => "<the message>",
"@version" => "1",
"@timestamp" => "2015-06-05T20:28:23.312Z",
"type" => "log4j",
"host" => "",
"path" => "com.ohadr.logs_provider.MyServlet",
"priority" => "INFO",
"logger_name" => "com.ohadr.logs_provider.MyServlet",
"thread" => "http-apr-8080-exec-3",
"class" => "?",
"file" => "?:?",
"method" => "?",

the issue is that the "path" field is wrong: AFAI understand, it should be the path of the log file; instead, I get the same value as "logger_name".

I have several apps on my tomcat that I want to collect the logs from. I need "path" to be the path-of-file (including the file-name), so I can distinguish between logs from different apps (each app logs to a different file).

How can it be done?


ps this Q is also here

Filename path to what? There is no filename context here. Your SocketAppender knows nothing about what filename any FileAppender or RollingFileAppender instances might be logging to.

1 Like