# Want to extract data from a file path, i have the path in mysql ? possible in logstash?

**URL:** <https://discuss.elastic.co/t/want-to-extract-data-from-a-file-path-i-have-the-path-in-mysql-possible-in-logstash/35240>\
**Category:** Logstash\
**Created:** [November 22, 2015, 7:22am UTC](https://discuss.elastic.co/t/want-to-extract-data-from-a-file-path-i-have-the-path-in-mysql-possible-in-logstash/35240 "2015-11-22T07:22:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hack\_Twentfour](https://avatars.discourse-cdn.com/v4/letter/h/82dd89/32.png) [@Hack\_Twentfour](https://discuss.elastic.co/u/Hack_Twentfour)\
**Post date:** [November 22, 2015, 7:22am UTC](https://discuss.elastic.co/t/want-to-extract-data-from-a-file-path-i-have-the-path-in-mysql-possible-in-logstash/35240/1 "2015-11-22T07:22:29Z")

</div>

Hi,  
I am very new to logstah. my requirement is read the log file path from mysql field and extract file for elasticseacrh.

something like this:  
Mysql database:testDB-\>fileTable-\>fileLocation :"/path/to/the/file.log"

I don't know if logstash will be able to do this\>?  
input { read the mysql fileLocation content using the input-jdbc-plugin}  
file{ path =\> pass/the/fileLocation } //this is another input but the path is coming from the above input.  
output to { Elasticsearch }

Thanks in advance  
-neo

---

<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:** [November 22, 2015, 9:02pm UTC](https://discuss.elastic.co/t/want-to-extract-data-from-a-file-path-i-have-the-path-in-mysql-possible-in-logstash/35240/2 "2015-11-22T21:02:53Z")

</div>

If the file whose path you get from the database is small and you're able to read the whole file in one swoop (rather than tail the file over a long time like the file input is meant to be used) you might be able to get away with a [ruby filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-ruby.html) or a small custom plugin, but it sounds like you're interested in a database driven Logstash configuration. That's not supported.

---

<div class="post-metadata">

**Author:** ![Hack\_Twentfour](https://avatars.discourse-cdn.com/v4/letter/h/82dd89/32.png) [@Hack\_Twentfour](https://discuss.elastic.co/u/Hack_Twentfour)\
**Post date:** [November 24, 2015, 5:50pm UTC](https://discuss.elastic.co/t/want-to-extract-data-from-a-file-path-i-have-the-path-in-mysql-possible-in-logstash/35240/3 "2015-11-24T17:50:17Z")

</div>

Thanks.  
I have a small file like 200kb - 1000kb and its a base64 encoded file, so we have a file   
Ex. test.file which contains base64 .

path from database will /document/datasets\_file/test.file

Please let me know what rugby filter to be used here..

---

<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:** [November 24, 2015, 9:06pm UTC](https://discuss.elastic.co/t/want-to-extract-data-from-a-file-path-i-have-the-path-in-mysql-possible-in-logstash/35240/4 "2015-11-24T21:06:35Z")

</div>

I can only point you in the right direction; I'm not going to write the Ruby code for you.

---

<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:21am UTC](https://discuss.elastic.co/t/want-to-extract-data-from-a-file-path-i-have-the-path-in-mysql-possible-in-logstash/35240/5 "2017-07-06T05:21:25Z")

</div>

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


