# Adding Field From MySQL

**URL:** <https://discuss.elastic.co/t/adding-field-from-mysql/134328>\
**Category:** Logstash\
**Created:** [June 3, 2018, 5:09pm UTC](https://discuss.elastic.co/t/adding-field-from-mysql/134328 "2018-06-03T17:09:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TestCandidate](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@TestCandidate](https://discuss.elastic.co/u/TestCandidate)\
**Post date:** [June 3, 2018, 5:09pm UTC](https://discuss.elastic.co/t/adding-field-from-mysql/134328/1 "2018-06-03T17:09:58Z")

</div>

**The setup:**

I have an Ubuntu 16 server. I've downloaded the ELK stack and configured filebeat to run with logstash. In other words filebeat -\> logstash -\> elastic.  
(mainly the configuration is that is found [here](http://robwillis.info/2017/04/elk-5-on-ubuntu-pt-2-installing-and-configuring-elasticsearch-logstash-kibana-nginx/))

**The CSV File:**

I have a CSV file similar to:

```
Value1;Value2;Value3;Value4

```

My Logstash Filter is as following:

```
csv {
  separator => ";"
  columns => ["Title1", "Title2", "Title3", "Title4"]
}

```

**The question**

I want to add a "Title5" Column with Value "Value5" fetched from mysql such as:

```
Select Title5 From ValuesTable Where Title1='Value1' AND Title3='Value3'

```

Is this possible? and how would you advise me to do it?

Thanks

---

<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 3, 2018, 7:18pm UTC](https://discuss.elastic.co/t/adding-field-from-mysql/134328/2 "2018-06-03T19:18:11Z")

</div>

Look into the jdbc\_static and jdbc\_streaming filters.

---

<div class="post-metadata">

**Author:** ![TestCandidate](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@TestCandidate](https://discuss.elastic.co/u/TestCandidate)\
**Post date:** [June 4, 2018, 7:44am UTC](https://discuss.elastic.co/t/adding-field-from-mysql/134328/3 "2018-06-04T07:44:23Z")

</div>

> [@magnusbaeck](#):
>
> jdbc\_streaming

jdbc streaming looks promising. but can i keep the CSV filter and use parameters from it? since I'm defining the columns there?

Thanks

---

<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 4, 2018, 9:37am UTC](https://discuss.elastic.co/t/adding-field-from-mysql/134328/4 "2018-06-04T09:37:27Z")

</div>

Yes, unless I'm misunderstanding the problem.

---

<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 22, 2018, 12:19pm UTC](https://discuss.elastic.co/t/adding-field-from-mysql/134328/6 "2018-07-22T12:19:20Z")

</div>

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