Automatic indexing data from MySQL to Kibana

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!

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