configurations of hq services
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

logging.nix 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. { config, pkgs, lib, ... }:
  2. let
  3. nginxGlobalLogging = ''
  4. log_format graylog2_json escape=json '{ "timestamp": "$time_iso8601", '
  5. '"remote_addr": "$remote_addr", '
  6. '"body_bytes_sent": $body_bytes_sent, '
  7. '"request_time": $request_time, '
  8. '"response_status": $status, '
  9. '"request": "$request", '
  10. '"request_method": "$request_method", '
  11. '"host": "$host",'
  12. '"upstream_cache_status": "$upstream_cache_status",'
  13. '"upstream_addr": "$upstream_addr",'
  14. '"http_x_forwarded_for": "$http_x_forwarded_for",'
  15. '"http_referrer": "$http_referer", '
  16. '"http_user_agent": "$http_user_agent" }';
  17. # replace the hostnames with the IP or hostname of your Graylog2 server
  18. access_log syslog:server=graylog.server.org:12301 graylog2_json;
  19. error_log syslog:server=graylog.server.org:12302;
  20. '';
  21. in
  22. {
  23. # add central logging
  24. services.journalbeat = {
  25. enable = true;
  26. extraConfig = ''
  27. journalbeat:
  28. seek_position: cursor
  29. cursor_seek_fallback: tail
  30. write_cursor_state: true
  31. cursor_flush_period: 5s
  32. clean_field_names: true
  33. convert_to_numbers: false
  34. move_metadata_to_field: journal
  35. default_type: journal
  36. kernel: true
  37. output.logstash:
  38. # Boolean flag to enable or disable the output module.
  39. enabled: true
  40. hosts: ["logging.serv.zentralwerk.org:5044", "172.20.73.13:5044"]
  41. '';
  42. };
  43. services.prometheus.exporters.node.enable = true;
  44. services.prometheus.exporters.node.openFirewall = true;
  45. }