# Automatic indexing data from MySQL to Kibana

**URL:** <https://discuss.elastic.co/t/automatic-indexing-data-from-mysql-to-kibana/274849>\
**Category:** Logstash\
**Created:** [June 3, 2021, 10:18am UTC](https://discuss.elastic.co/t/automatic-indexing-data-from-mysql-to-kibana/274849 "2021-06-03T10:18:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pablixelastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pablixelastic/32/89018_2.png) [@pablixelastic](https://discuss.elastic.co/u/pablixelastic)\
**Post date:** [June 3, 2021, 10:18am UTC](https://discuss.elastic.co/t/automatic-indexing-data-from-mysql-to-kibana/274849/1 "2021-06-03T10:18:26Z")

</div>

Hi there,

I want to know which tool do i have to use to automatically index data from my MySQL table (where i also do changes in the existing data) to my index in Kibana.  
I've been trying modifying the _mysql.conf_ and then running it with logstash but nothing works.

Here it's my config:

```
input {
  jdbc {
    jdbc_driver_library => "C:\Users\admpablos\Documents\Elastic\logstash-7.12.1\mysql-connector-java-5.1.44-bin.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://localhost:3306/My_BBDD?useSSL=false"
    jdbc_user => "My_User"
    jdbc_password => "My_Password"
    schedule => "*/5 * * * * *"
    statement => "SELECT *, UNIX_TIMESTAMP(last_modified_time) AS unix_ts_in_secs FROM My_Table WHERE (UNIX_TIMESTAMP(last_modified_time) > :sql_last_value AND last_modified_time < NOW()) ORDER BY last_modified_time ASC"
    tracking_column =>last_modified_time
    use_column_value =>true
    tracking_column_type => "timestamp"
    clean_run => true
  }
jdbc {
    jdbc_driver_library => "C:\Users\admpablos\Documents\Elastic\logstash-7.12.1\mysql-connector-java-5.1.44-bin.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://localhost:3306/My_Second_BBDD?useSSL=false"
    jdbc_user => "My_User"
    jdbc_password => "My_Password"
    schedule => "*/5 * * * * *"
    statement => "SELECT *, UNIX_TIMESTAMP(last_modified_time) AS unix_ts_in_secs FROM My_Second_Table WHERE (UNIX_TIMESTAMP(last_modified_time) > :sql_last_value AND last_modified_time < NOW()) ORDER BY last_modified_time ASC"
    tracking_column =>last_modified_time
    use_column_value =>true
    tracking_column_type => "timestamp"
    clean_run => true
  }
}

filter {
  mutate {
    copy => { "id" => "[@metadata][_id]"}
    remove_field => ["id", "@version", "unix_ts_in_secs"]
  }
}

output {
  if [tags] == "My_Table"{
     elasticsearch {
       hosts => ["localhost:9200"]
       index => "My_Index"
       user => "My_User"
       password => "My_Password"
       action => "update"
       document_id => "%{[@metadata][_id]}"
       doc_as_upsert =>true
     }
  }
  if [tags] == "My_Second_Table"{
     elasticsearch {
       hosts => ["localhost:9200"]
       index => "My_Second_Index"
       user => "My_User"
       password => "My_Password"
       action => "update"
       document_id => "%{[@metadata][_id]}"
       doc_as_upsert => true
     }
  }
stdout{ codec => rubydebug }
}

```

Any help is welcome!

---

<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 1, 2021, 10:19am UTC](https://discuss.elastic.co/t/automatic-indexing-data-from-mysql-to-kibana/274849/2 "2021-07-01T10:19:20Z")

</div>

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