# Need to parse logs and enrich some values from mysql data at logstats

**URL:** <https://discuss.elastic.co/t/need-to-parse-logs-and-enrich-some-values-from-mysql-data-at-logstats/259176>\
**Category:** Logstash\
**Created:** [December 19, 2020, 7:54pm UTC](https://discuss.elastic.co/t/need-to-parse-logs-and-enrich-some-values-from-mysql-data-at-logstats/259176 "2020-12-19T19:54:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhi.coerian](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@abhi.coerian](https://discuss.elastic.co/u/abhi.coerian)\
**Post date:** [December 19, 2020, 7:54pm UTC](https://discuss.elastic.co/t/need-to-parse-logs-and-enrich-some-values-from-mysql-data-at-logstats/259176/1 "2020-12-19T19:54:40Z")

</div>

Need to parse logs on logstash and enrich some values from mysql db based on the log message and generate json message .

e.x JOB application\_1603918538928\_3286731 QUEUE default USER xyz

Need to fetch details of USER : xyz from db and append with the message in json format.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [December 19, 2020, 8:07pm UTC](https://discuss.elastic.co/t/need-to-parse-logs-and-enrich-some-values-from-mysql-data-at-logstats/259176/2 "2020-12-19T20:07:30Z")

</div>

You can enrich an event with data from a database using either the jdbc\_static or jdbc\_streaming filter, depending on your use case. If you want to output messages in json format you can use a json codec on the output.

---

<div class="post-metadata">

**Author:** ![abhi.coerian](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@abhi.coerian](https://discuss.elastic.co/u/abhi.coerian)\
**Post date:** [December 20, 2020, 4:45am UTC](https://discuss.elastic.co/t/need-to-parse-logs-and-enrich-some-values-from-mysql-data-at-logstats/259176/3 "2020-12-20T04:45:50Z")

</div>

@Badger, can we do this on java filter as well?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [December 20, 2020, 3:58pm UTC](https://discuss.elastic.co/t/need-to-parse-logs-and-enrich-some-values-from-mysql-data-at-logstats/259176/4 "2020-12-20T15:58:07Z")

</div>

> [@abhi.coerian](#):
>
> can we do this on java filter as well?

If you are asking whether you could write a filter in java that does this then the answer is yes.

---

<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:** [January 17, 2021, 3:58pm UTC](https://discuss.elastic.co/t/need-to-parse-logs-and-enrich-some-values-from-mysql-data-at-logstats/259176/5 "2021-01-17T15:58:15Z")

</div>

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