Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. $cat ~/.logstash_jdbc_last_run
  2. --- 2017-03-08 09:29:00.259000000 Z
  3.  
  4. $date
  5. mer 8 mar 2017, 10.29.31, CET
  6. $cat /etc/timezone
  7. Europe/Rome
  8.  
  9. input {
  10. jdbc {
  11. # Postgres jdbc connection string to our database, mydb
  12. jdbc_connection_string => "jdbc:postgresql://localhost:5432/postgres"
  13. # The user we wish to execute our statement as
  14. jdbc_user => "logstash"
  15. jdbc_password => "logstashpass"
  16. # The path to our downloaded jdbc driver
  17. jdbc_driver_library => "/home/trex/Development/ship_to_elasticsearch/software/postgresql-42.0.0.jar"
  18. # The name of the driver class for Postgresql
  19. jdbc_driver_class => "org.postgresql.Driver"
  20. jdbc_default_timezone => "Europe/Rome"
  21. # our query
  22. statement => "SELECT * FROM contacts WHERE timestamp > :sql_last_value"
  23. # every 1 min
  24. schedule => "*/1 * * * *"
  25. }
  26. }
  27. output {
  28. stdout { codec => json_lines }
  29. elasticsearch {
  30. hosts => [ "localhost:9200" ]
  31. index => "database.%{+yyyy.MM.dd.HH}"
  32. }
  33. }
  34.  
  35. postgres=# select * from "contacts"; uid | timestamp | email | first_name | last_name
  36. -----+----------------------------+-------------------------+------------+------------
  37. 1 | 2017-03-07 18:09:25.358684 | jim@example.com | Jim | Smith
  38. 2 | 2017-03-07 18:09:25.3756 | | John | Smith
  39. 3 | 2017-03-07 18:09:25.384053 | carol@example.com | Carol | Smith
  40. 4 | 2017-03-07 18:09:25.869833 | sam@example.com | Sam |
  41. 5 | 2017-03-08 10:04:26.39423 | trex@example.com | T | Rex
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement