# How can I import json data from Mysql 5.5 to logstash 1.4.2?

**URL:** <https://discuss.elastic.co/t/how-can-i-import-json-data-from-mysql-5-5-to-logstash-1-4-2/74740>\
**Category:** Logstash\
**Created:** [February 11, 2017, 3:47am UTC](https://discuss.elastic.co/t/how-can-i-import-json-data-from-mysql-5-5-to-logstash-1-4-2/74740 "2017-02-11T03:47:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pythonl1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pythonl1/32/15437_2.png) [@pythonl1](https://discuss.elastic.co/u/pythonl1)\
**Post date:** [February 11, 2017, 3:47am UTC](https://discuss.elastic.co/t/how-can-i-import-json-data-from-mysql-5-5-to-logstash-1-4-2/74740/1 "2017-02-11T03:47:24Z")

</div>

Hi,

I am using ELK stack on an Ubuntu 14.04 server. The versions of each application is as follows:  
Elasticsearch: 0.90.13  
Logstash: 1.4.2  
Kibana: 3.0.1

I have succeeded in establishing connection between the three applications and logs are being displayed in kibana.

I have been asked to log some of the json data that was being stored in mysql to centralised logging system as well.

I have tried jdbc-river but its been futile, since I can't get it to import my logs from mysql.

I cannot upgrade elasticsearch as several components in my project are not compatible with higher versions and it will create conflict.

Please help!

PS: I am not getting any logs registered in /var/log/elasticsearch/elasticsearch.log file.Althought there should have been loads of logs.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 12, 2017, 2:20am UTC](https://discuss.elastic.co/t/how-can-i-import-json-data-from-mysql-5-5-to-logstash-1-4-2/74740/2 "2017-02-12T02:20:15Z")

</div>

You should really upgrade, those are _very, very_ old versions. At least upgrade Logstash, it's not locked to any ES version.

Have you seen [https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html)?

---

<div class="post-metadata">

**Author:** ![pythonl1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pythonl1/32/15437_2.png) [@pythonl1](https://discuss.elastic.co/u/pythonl1)\
**Post date:** [February 13, 2017, 6:58am UTC](https://discuss.elastic.co/t/how-can-i-import-json-data-from-mysql-5-5-to-logstash-1-4-2/74740/3 "2017-02-13T06:58:43Z")

</div>

Thank you so much. I was not upgrading logstash because I thought it was same as kibana and ES. That it needed to be of specific version. Thank you for all the help.

---

<div class="post-metadata">

**Author:** ![Lakshmi\_D](https://avatars.discourse-cdn.com/v4/letter/l/bc8723/32.png) [@Lakshmi\_D](https://discuss.elastic.co/u/Lakshmi_D)\
**Post date:** [February 13, 2017, 6:19pm UTC](https://discuss.elastic.co/t/how-can-i-import-json-data-from-mysql-5-5-to-logstash-1-4-2/74740/4 "2017-02-13T18:19:05Z")

</div>

@pythonl1 can you plz help to set up the connection btw three applications?

i/m not able to seee logs in kibana?

input {  
tcp {  
port =\> 5000  
type =\> "company-tcp"  
codec =\> "json"  
}  
udp {  
port =\> 5000  
type =\> "company-udp"  
codec =\> "json"  
}  
}

output {  
if ("METRICS" in [tags]) {  
elasticsearch {  
hosts =\> ["elasticsearch"]  
index =\> "metrics-%{+YYYY.MM.dd}"  
}  
} else {  
elasticsearch {  
hosts =\> ["elasticsearch"]  
index =\> "logstash-%{+YYYY.MM.dd}"  
}  
}  
stdout {  
codec =\> rubydebug  
}  
}

---

<div class="post-metadata">

**Author:** ![pythonl1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pythonl1/32/15437_2.png) [@pythonl1](https://discuss.elastic.co/u/pythonl1)\
**Post date:** [February 13, 2017, 7:56pm UTC](https://discuss.elastic.co/t/how-can-i-import-json-data-from-mysql-5-5-to-logstash-1-4-2/74740/5 "2017-02-13T19:56:06Z")

</div>

@Lakshmi_D I think your code should be something like this:

```
 {
	tcp {
		hosts => ["ip_from_where_your_data_is_being_called:5000"]
		port => 5000
		type => "company-tcp"
		codec => "json"
	}
	udp {
		hosts => ["ip_from_where_your_data_is_being_called:5000"]
		port => 5000
		type => "company-udp"
		codec => "json"
	}
}

output {
	if [tag] == "metrics" {
		elasticsearch {
			hosts => ["elasticsearch_ip_or_dns"]
			index => "metrics-%{+YYYY.MM.dd}"
		}
	} else {
		elasticsearch {
			hosts => ["elasticsearch_ip_or_dns"]
			index => "logstash-%{+YYYY.MM.dd}"
		}
	}
	stdout {
		codec => rubydebug
    }
}
```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 13, 2017, 10:20pm UTC](https://discuss.elastic.co/t/how-can-i-import-json-data-from-mysql-5-5-to-logstash-1-4-2/74740/6 "2017-02-13T22:20:00Z")

</div>

Please start your own thread.

---

<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 13, 2017, 10:20pm UTC](https://discuss.elastic.co/t/how-can-i-import-json-data-from-mysql-5-5-to-logstash-1-4-2/74740/7 "2017-03-13T22:20:08Z")

</div>

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