Guest User

Untitled

a guest
Aug 25th, 2019
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. input {
  2. jdbc {
  3. jdbc_connection_string => "jdbc:postgresql://db:5432/blog_db"
  4. jdbc_user => "admin_user"
  5. jdbc_password => "admin_user_password"
  6. jdbc_driver_library => "/usr/share/java/postgresql-42.2.6.jar"
  7. jdbc_driver_class => "org.postgresql.Driver"
  8. schedule => "* * * * *"
  9. statement => "SELECT id, text, name FROM post"
  10. add_field => {
  11. "table" => "post"
  12. }
  13. jdbc_paging_enabled => "true"
  14. jdbc_page_size => "10000"
  15. }
  16. }
  17. filter {
  18. if ([id]) {
  19. mutate {
  20. add_field => {
  21. "[@metadata][document_id]" => "%{id}"
  22. }
  23. }
  24. }
  25. }
  26. output {
  27. elasticsearch {
  28. template_name => "posts"
  29. index => "%{table}-%{+YYYY.MM.dd.HH.mm}"
  30. hosts => ["elasticsearch:9200"]
  31. template => '/etc/logstash/conf.d/template.json'
  32. document_id => "%{table}_%{[@metadata][document_id]}"
  33. }
  34. }
RAW Paste Data