Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $cat ~/.logstash_jdbc_last_run
- --- 2017-03-08 09:29:00.259000000 Z
- $date
- mer 8 mar 2017, 10.29.31, CET
- $cat /etc/timezone
- Europe/Rome
- input {
- jdbc {
- # Postgres jdbc connection string to our database, mydb
- jdbc_connection_string => "jdbc:postgresql://localhost:5432/postgres"
- # The user we wish to execute our statement as
- jdbc_user => "logstash"
- jdbc_password => "logstashpass"
- # The path to our downloaded jdbc driver
- jdbc_driver_library => "/home/trex/Development/ship_to_elasticsearch/software/postgresql-42.0.0.jar"
- # The name of the driver class for Postgresql
- jdbc_driver_class => "org.postgresql.Driver"
- jdbc_default_timezone => "Europe/Rome"
- # our query
- statement => "SELECT * FROM contacts WHERE timestamp > :sql_last_value"
- # every 1 min
- schedule => "*/1 * * * *"
- }
- }
- output {
- stdout { codec => json_lines }
- elasticsearch {
- hosts => [ "localhost:9200" ]
- index => "database.%{+yyyy.MM.dd.HH}"
- }
- }
- postgres=# select * from "contacts"; uid | timestamp | email | first_name | last_name
- -----+----------------------------+-------------------------+------------+------------
- 1 | 2017-03-07 18:09:25.358684 | jim@example.com | Jim | Smith
- 2 | 2017-03-07 18:09:25.3756 | | John | Smith
- 3 | 2017-03-07 18:09:25.384053 | carol@example.com | Carol | Smith
- 4 | 2017-03-07 18:09:25.869833 | sam@example.com | Sam |
- 5 | 2017-03-08 10:04:26.39423 | trex@example.com | T | Rex
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement