Advertisement
thanh_thu

Logstach_filebeat

Jun 16th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. 1/Config logstash
  2. => vi conf.d/filebeat-input.conf
  3.  
  4. input {
  5. beats {
  6. port => 5044
  7. ssl => true
  8. ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder.crt"
  9. ssl_key => "/etc/pki/tls/private/logstash-forwarder.key"
  10. }
  11. }
  12.  
  13.  
  14. => vi conf.d/syslog-filter.conf
  15.  
  16. filter {
  17. if [type] == "syslog" {
  18. grok {
  19. match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
  20. add_field => [ "received_at", "%{@timestamp}" ]
  21. add_field => [ "received_from", "%{host}" ]
  22. }
  23. date {
  24. match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
  25. }
  26. }
  27. }
  28.  
  29. => vi conf.d/output-elasticsearch.conf
  30.  
  31. output {
  32. elasticsearch { hosts => ["localhost:9200"]
  33. hosts => "localhost:9200"
  34. manage_template => false
  35. index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
  36. document_type => "%{[@metadata][type]}"
  37. }
  38. }
  39.  
  40. 2/ Config filebeat
  41. => filebeat.yml
  42.  
  43. cat > /etc/filebeat/filebeat.yml << EOF
  44. filebeat:
  45. prospectors:
  46. -
  47. paths:
  48. - /var/log/*.log
  49. encoding: utf-8
  50. input_type: log
  51. fields:
  52. level: debug
  53. document_type: type
  54. registry_file: /var/lib/filebeat/registry
  55. setup.kibana;
  56. hosts: "192.168.10.86:5601"
  57. output:
  58. logstash:
  59. hosts: ["127.0.0.1:5044"]
  60. worker: 1
  61. bulk_max_size: 2048
  62. logging:
  63. to_syslog: false
  64. to_files: true
  65. files:
  66. path: /var/log/filebeat
  67. name: filebeat
  68. rotateeverybytes: 1048576000 # = 1GB
  69. keepfiles: 7
  70. selectors: ["*"]
  71. level: info
  72. EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement