# Import data from MySQL to elasticsearch with logstash after preprocessing

**URL:** <https://discuss.elastic.co/t/import-data-from-mysql-to-elasticsearch-with-logstash-after-preprocessing/122020>\
**Category:** Logstash\
**Created:** [March 1, 2018, 9:54am UTC](https://discuss.elastic.co/t/import-data-from-mysql-to-elasticsearch-with-logstash-after-preprocessing/122020 "2018-03-01T09:54:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![M.alsioufi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/m.alsioufi/32/52269_2.png) [@M.alsioufi](https://discuss.elastic.co/u/M.alsioufi)\
**Post date:** [March 1, 2018, 9:54am UTC](https://discuss.elastic.co/t/import-data-from-mysql-to-elasticsearch-with-logstash-after-preprocessing/122020/1 "2018-03-01T09:54:51Z")

</div>

I am trying to import data from MySQL to elasticsearch using logstash, everything works fine and I have all the data imported well. However, one of the fields in MySQL called "metadata" is following a specific pattern like this "firstname\_lastname\_yyyy-MM-dd HH:mm:ss" so for example this is one of the values it may take "Mark\_Karlos\_2018-02-23 15:19:55", at the moment this field is imported to Elasticsearch as it is, what I want to do is to have this field as three fields in Elasticsearch "first\_name", "last\_name", "time". Is this possible to be done with Logstash config file? If not is there any other way to do this?

---

<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:** [March 1, 2018, 8:07pm UTC](https://discuss.elastic.co/t/import-data-from-mysql-to-elasticsearch-with-logstash-after-preprocessing/122020/2 "2018-03-01T20:07:51Z")

</div>

You can e.g. use a grok or a dissect filter.

---

<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:** [March 29, 2018, 8:08pm UTC](https://discuss.elastic.co/t/import-data-from-mysql-to-elasticsearch-with-logstash-after-preprocessing/122020/3 "2018-03-29T20:08:23Z")

</div>

Closed on March 29, 2018, 8:08pm UTC

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