# cat /etc/logstash/conf.d/mysqlBA.conf
input {
jdbc {
jdbc_driver_library => "/usr/share/java/mysql-connector-java.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/xf"
jdbc_user => "root"
jdbc_password => "xxxxx"
schedule => "0 * * * *"
statement => "select xf_post.username, count(*) as posts, count(xf_thread.best_answer_id) as best_answers, sum(xf_post.likes) as likes from xf_post left join xf_thread on (xf_post.post_id = xf_thread.best_answer_id and xf_thread.best_answer_id > 0) where xf_post.post_date between UNIX_TIMESTAMP('2017-11-01 00:00:00') and UNIX_TIMESTAMP('2017-12-01 00:00:00') group by xf_post.username order by posts desc limit 25"
}
}
output {
elasticsearch {
hosts => ["http://talkkib.plesk.com:9200/"]
index => "forum_stat_%{+YYYY.MM.dd}"
document_type => "forum_stat"
}
# stdout { codec => rubydebug }
}
All works good. But the problem in that in Kibana I see the same index structure for forum_stat_%{+YYYY.MM.dd} like forum_stat_%{+YYYY.MM.dd} with additional fields 'posts', 'likes', 'best_answers', 'username'. I suspect that size of this index forum_stat_%{+YYYY.MM.dd} grows so fast dut to data from nginx logs. Could you please clarify - why? I need forum_stat_%{+YYYY.MM.dd} index with very simple structure and small size.
Please help me with this. Additionally it would be very good if you correct my configs with any useful customizations from your great experience!
When you have multiple configuration files in a single pipeline (the only option prior to Logstash 6), all events from all inputs will be passed to all filters and all outputs unless you use conditionals to apply filters and outputs conditionally. Your current configuration is equivalent to this:
Logstash concatenates all config files in that directory, which means all event will go to all outputs unless you use conditionals to separate the flows. There should be numerous examples in this forum.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.