Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. input {
  2. file {
  3. path => ["/usr/local/logstash/conf/lbd2tbd/wait_transfer_txt.txt"]
  4. start_position => "beginning"
  5. sincedb_path => "/dev/null"
  6. }
  7. }
  8. filter {
  9.  
  10. mutate {
  11. split => { "message" => " "}
  12. }
  13. mutate {
  14. add_field => {"lbdId"=>"%{message[0]}" "viewerId"=>"%{message[1]}"}
  15. }
  16. mutate {
  17. gsub => [ "viewerId", "\r", "" ]
  18. remove_field => [ "message" ]
  19. }
  20.  
  21. jdbc_streaming {
  22. jdbc_driver_library => "/usr/local/logstash/sqlserver/sqljdbc4-4.0.jar"
  23. jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
  24. jdbc_connection_string => "jdbc:sqlserver://xxxxxxx;DatabaseName=xxxxx"
  25. jdbc_user => "xxx"
  26. jdbc_password => "xxxxx"
  27. statement => "SELECT TBDObjectId FROM xxx.dbo.xxx WHERE xxx = :lbdId;"
  28. parameters => { "lbdId" => "lbdId"}
  29. target => "tbdId"
  30. }
  31.  
  32. jdbc_streaming {
  33. jdbc_driver_library => "/usr/local/logstash/sqlserver/sqljdbc4-4.0.jar"
  34. jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
  35. jdbc_connection_string => "jdbc:sqlserver://xxxx:xxx;DatabaseName=xxxx"
  36. jdbc_user => "xxx"
  37. jdbc_password => "xxxx"
  38. statement => "SELECT UnionId FROM xxx.dbo.xxx WHERE Id = :viewerId"
  39. parameters => { "viewerId"=> "viewerId"}
  40. target => "unionId"
  41. }
  42. mutate {
  43. replace => { "tbdId" => "%{[tbdId][0][tbdobjectid]}" "unionId" => "%{[unionId][0][unionid]}" }
  44. }
  45. }
  46. output {
  47. stdout {
  48. codec => rubydebug{}
  49. }
  50. file {
  51. path => "result.txt"
  52. codec => line { format => "%{lbdId}>%{tbdId}|%{viewerId}>%{unionId}"}
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement