input {
	jdbc {
		jdbc_driver_library => "/home/centos/logstash/mysql-connector-java-5.1.43-bin.jar"
		jdbc_driver_class => "com.mysql.jdbc.Driver"
		jdbc_connection_string => "jdbc:mysql://127.0.0.1:33060/ig_campaigns"
		jdbc_user => "admin"
		jdbc_password => "OurInsDB123!"
		statement => "select likes_last_hour, new_likes_last_hour, follows_last_hour, new_follows_last_hour, new_like_campagin_last_hour, new_follow_campagin_last_hour, DATE_FORMAT(CONVERT_TZ(updated, '+00:00','+08:00'), '%Y-%m-%d %H:%i:%s') as updated from statistics_global where updated > CONVERT_TZ(:sql_last_value, '+08:00','+00:00')"
		use_column_value => true
		tracking_column => "updated"
		tracking_column_type => "timestamp"
		clean_run => true
	}
}

filter {
	date {
           match => ["updated","YYYY-MM-dd HH:mm:ss"]
           timezone => "Asia/Shanghai"
           locale => "en"
           target => "@timestamp"
    }
}

output {
	stdout {codec => json_lines}
	elasticsearch {
	 "hosts" => "https://vpc-insdata-cig5iwmusetibd2qmkogvbwonu.us-west-2.es.amazonaws.com:443"
	 "index" => "campaign"
	 "document_type" => "data"
	}
}
