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

**URL:** <https://discuss.elastic.co/t/logstash-in-log4j-input-the-path-is-not-correct/2072>\
**Category:** Logstash\
**Created:** [June 6, 2015, 7:32pm UTC](https://discuss.elastic.co/t/logstash-in-log4j-input-the-path-is-not-correct/2072 "2015-06-06T19:32:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohadR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ohadr/32/130085_2.png) [@ohadR](https://discuss.elastic.co/u/ohadR)\
**Post date:** [June 6, 2015, 7:32pm UTC](https://discuss.elastic.co/t/logstash-in-log4j-input-the-path-is-not-correct/2072/1 "2015-06-06T19:32:26Z")

</div>

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" => "127.0.0.1:52083",
"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?

thanks!

ps this Q is also [here](http://stackoverflow.com/questions/30675786/logstash-in-log4j-input-the-path-is-not-correct)

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 7, 2015, 9:36am UTC](https://discuss.elastic.co/t/logstash-in-log4j-input-the-path-is-not-correct/2072/2 "2015-06-07T09:36:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 5:38am UTC](https://discuss.elastic.co/t/logstash-in-log4j-input-the-path-is-not-correct/2072/3 "2017-07-06T05:38:17Z")

</div>

Closed on July 6, 2017, 5:38am UTC


