How to create this multiple line graph?


(Philippe Courtemanche) #1

This graph:
multipleLineGraph

Obtained using these two sql querries:


(Brandon Kobel) #2

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:


(Philippe Courtemanche) #3

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


(Philippe Courtemanche) #4

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);"
    }

}

Add your filters / logstash plugins configuration here

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"
}
}
}


(system) #5

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