Advertisement
Guest User

Untitled

a guest
Dec 14th, 2020
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. 1. filebeat.yml (not full file, other lines are default except connection to logstash):
  2. filebeat.inputs:
  3.  
  4. #multiline.type: pattern
  5. #multiline.pattern: '^\[[0-9]{4}-[0-9]{2}-[0-9]{2}'
  6. #multiline.negate: true
  7. #multiline.match: after
  8.  
  9. - type: log
  10. processors:
  11. - drop_event:
  12. when:
  13. regexp:
  14. message: "DEBUG -- :"
  15. #- include_fields:
  16. # fields: ["deviceId", "productId", "lang_from", "lang_to", "text"]
  17. enabled: true
  18. paths:
  19. - /home/passenger/translation-worker/log/production.log
  20. # - /home/passenger/translation-worker/log/sidekiq.log
  21. fields:
  22. tworker: 1
  23. #- type: filestream
  24. # enabled: false
  25. # paths:
  26. # - /var/log/*.log
  27.  
  28.  
  29.  
  30. 2. logstash config file placed in conf.d/general.conf:
  31. input {
  32. beats {
  33. client_inactivity_timeout => 600
  34. port => 5045
  35. ssl => true
  36. ssl_certificate_authorities => ["/etc/logstash/test2/ca.crt"]
  37. ssl_certificate => "/etc/logstash/test2/logstash.crt"
  38. ssl_key => "/etc/logstash/test2/logstash.key"
  39. ssl_verify_mode => "force_peer"
  40. }
  41. }
  42.  
  43. filter {
  44. grok {
  45. patterns_dir => ["/etc/logstash/patterns"]
  46. match => { "message" => "%{DEVICE_ID:device_id} %{PRODUCT_ID:product_id} %{LANG:lang_from} %{LANG:lang_to} %{TEXT:text}" }
  47. }
  48. }
  49.  
  50. output {
  51. elasticsearch {
  52. hosts => ["http://localhost:9200"]
  53. index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
  54. user => "${user}"
  55. password => "${password}"
  56. }
  57. stdout { codec => rubydebug }
  58. }
  59.  
  60.  
  61.  
  62. 3. Patterns from /etc/logstash/patterns:
  63. DEVICE_ID [0-9A-Z\!@#$%^&*()._]{11,16}
  64. LANG [a-z]{2}
  65. PRODUCT_ID aaa.bbbbb\.[0-9a-zA-Z]{4,11}\.*[0-9a-zA-Z\_]{1,}\.*[0-9a-zA-Z\_]{1,}\.*[0-9a-zA-Z\_]{1,}
  66. TEXT [0-9a-zA-Z]{1,}
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement