# Log4J

**URL:** <https://discuss.elastic.co/t/log4j/95345>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [August 1, 2017, 1:18pm UTC](https://discuss.elastic.co/t/log4j/95345 "2017-08-01T13:18:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![whgibbo](https://avatars.discourse-cdn.com/v4/letter/w/7ba0ec/32.png) [@whgibbo](https://discuss.elastic.co/u/whgibbo)\
**Post date:** [August 1, 2017, 1:18pm UTC](https://discuss.elastic.co/t/log4j/95345/1 "2017-08-01T13:18:29Z")

</div>

Hi,  
I'm new to using Filebeats/Logstash and have a application that is using Log4J and wanted to know what was the best option to allow for searching/filters based on the information in the log file from Kibana..

Here is a sample of the line entry:

> 2017-07-12 03:58:36,718 WARN [ThreadName] com.test.namespace - Message  
> 2017-07-12 03:58:36,719 INFO [ThreadName] com.test.namespace - Message2

I would like to be able to filter based upon:

- Log Level
- ThreadName
- Namespace
- message or contents of the message, which could be multiline.

I understand that filebeat won't be having Grok, but instead it is going to be put them into Elasticsearch.  
Anybody have a good example for this ?

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [August 1, 2017, 2:14pm UTC](https://discuss.elastic.co/t/log4j/95345/2 "2017-08-01T14:14:45Z")

</div>

For filebeat, consider to configure multiline support (check line starts with timestamp), such that stack-traces will be part of the error event. This is a common pattern and you might find samples in this forum (search for multiline) and [docs](https://www.elastic.co/guide/en/beats/filebeat/current/multiline-examples.html). For your timestamps use the regex `'^[0-9]{4}-[0-9]{2}-[0-9]{2} '`

have you had a look at [elasticsearch ingest node](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html)? You can configure an ingest pipeline to do some parsing (via grok), to extract some more structured information from your logs. This will simplify searching and filtering a ton. For example by timespan, log level, class name, message and others.

[Filebeat modules](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-modules.html) do have some sample configurations, but no java/log4j specific services in there (log format of log4j is somewhat configurable). Also see modules implementations for existing examples: [https://github.com/elastic/beats/tree/master/filebeat/module](https://github.com/elastic/beats/tree/master/filebeat/module)

---

<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:** [August 29, 2017, 2:14pm UTC](https://discuss.elastic.co/t/log4j/95345/3 "2017-08-29T14:14:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
