This graph:
Obtained using these two sql querries:
Hey @PhilippeCourtemanche, it really depends on how you have your data indexed into Elasticsearch. The following is an example of creating a Line-Chart with a Date Histogram that is creating two lines using a filters aggregation:
Hi, thanks for the reply
Would it help you if I sent you my logstash.conf file?
I think that's where I "indexed my data into Elasticsearch".
I'm still new to all of this
Here are the corresponding lines in my logstash.conf file:
input {
tcp {
type => "tcp_events"
port => 5000
}
jdbc {
type => "jdbc_nb_compte"
schedule => "* * * * *"
# Add rest of jdbc config
# MySQL jdbc connection string to our database, mydb
jdbc_connection_string => "jdbc:mysql://192.168.66.11:3306/gmvet"
# The user we wish to execute our statement as
jdbc_user => "gmvet"
jdbc_password => "gmvet"
# The path to our downloaded jdbc driver
jdbc_driver_library => "/usr/share/logstash/config/mysql-connector-java-5.1.46-bin.jar"
# The name of the driver class for MySQL
jdbc_driver_class => "com.mysql.jdbc.Driver"
# our query
statement => "select dateCreated as temps,count(*) from Account group by YEAR(dateCreated), MONTH(dateCreated);"
}
jdbc {
type => "jdbc_nb_sites"
schedule => "* * * * *"
# Add rest of jdbc config
# MySQL jdbc connection string to our database, mydb
jdbc_connection_string => "jdbc:mysql://192.168.66.11:3306/gmvet"
# The user we wish to execute our statement as
jdbc_user => "gmvet"
jdbc_password => "gmvet"
# The path to our downloaded jdbc driver
jdbc_driver_library => "/usr/share/logstash/config/mysql-connector-java-5.1.46-bin.jar"
# The name of the driver class for MySQL
jdbc_driver_class => "com.mysql.jdbc.Driver"
# our query
statement => "select dateCreated as temps, count(*) from Site group by YEAR(dateCreated), MONTH(dateCreated);"
}
}
output {
if [type] == "jdbc_nb_compte" {
stdout { codec => json_lines }
elasticsearch {
hosts => "elasticsearch:9200"
index => "jdbc_nb_compte_1"
document_type => "data"
}
}
if [type] == "jdbc_nb_sites" {
stdout { codec => json_lines }
elasticsearch {
hosts => "elasticsearch:9200"
index => "jdbc_nb_sites"
document_type => "data"
}
}
}
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
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.