Use Index templalte in logstash

Hi,
I have create a new index template. I want to reference my new template in logstash configuration. Following is my configuration file

input {
  jdbc {
    jdbc_driver_library => "/usr/share/java/mysql.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://172.31.15.138:3310/uwtinpewnf"
    jdbc_user => "appapi"
    jdbc_password => "asdfsASdf@3rf"
    jdbc_paging_enabled => true
    jdbc_page_size => 10000
    tracking_column => "pro_updated_at"
    use_column_value=>true
    # statement => "select * from `es_product_detail_info` where `pro_updated_date` >=:sql_last_value"
    schedule => "*/10 * * * *"
    statement => "select * from es_product_detail_parse where (UNIX_TIMESTAMP(`pro_updated_at`) >:sql_last_value and pro_updated_at < now()) ORDER BY pro_updated_at asc"

 }
}
output {
  elasticsearch {
    document_id=> "%{document_id}"
    # document_type => "doc"
    index => "products"
    doc_as_upsert => true
    hosts => ["http://localhost:9200"]
  }
  stdout{
    codec => rubydebug
  }
}

thanks

there’s a template directive for elasticsearch output

I have found the way. You need to create template "prefix*" in my case I create template with "pro*". Using same logstash configuration it will create index using template.

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