Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. # Configuring Graylog on Clients
  2.  
  3. ## Docker Configuration
  4.  
  5. To configure Docker to use the `json` log driver, edit the following file:
  6.  
  7. `sudo nano /etc/docker/daemon.json`
  8.  
  9. Then add the following configuration:
  10.  
  11. ```
  12. {
  13. "log-driver": "json-file"
  14. }
  15. ```
  16.  
  17. On startup, the Docker daemon will automatically check this file for configurations and use those.
  18.  
  19. To get these changes to take effect, the Docker daemon needs to be restarted and any running containers destroyed and recreated.
  20.  
  21. `sudo systemctl restart docker`
  22.  
  23. Now recreate any running containers and all logs will be sent straight to Graylog.
  24.  
  25. ## Filebeat Configuration
  26.  
  27. Deploy the filebeat stack on the server with the following config:
  28.  
  29. ```
  30. version: "3.7"
  31.  
  32. volumes:
  33. filebeat:
  34. external: true
  35.  
  36. services:
  37.  
  38. filebeat:
  39. image: docker.elastic.co/beats/filebeat:7.2.0
  40. user: root
  41. hostname: hpe-private-swarm-x86-dss1-staging
  42. volumes:
  43. - filebeat:/usr/share/filebeat
  44. - /var/lib/docker/containers:/var/lib/docker/containers/:ro
  45. - /var/run/docker.sock:/var/run/docker.sock
  46. ```
  47.  
  48. And create the following YAML file in the volume:
  49.  
  50. `sudo nano filebeat.yml`
  51.  
  52. ```
  53. filebeat.config:
  54. modules:
  55. path: ${path.config}/modules.d/*.yml
  56. reload.enabled: false
  57.  
  58. filebeat.inputs:
  59. - type: container
  60. enabled: true
  61. paths:
  62. - '/var/lib/docker/containers/*/*.log'
  63. multiline.pattern: '^v[0-9]\.[0-9][0-9]-'
  64. multiline.negate: true
  65. multiline.match: after
  66.  
  67. processors:
  68. - add_docker_metadata:
  69. host: "unix:///var/run/docker.sock"
  70.  
  71. output.logstash:
  72. hosts: ["192.168.1.40:5044"]
  73.  
  74. logging.metrics.period: 300s
  75. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement