Настройка input и экстракторов для приёма логов от nginx#

Добавить input Syslog UDP#

В System - Inputs нужно добавить Syslog UDP

Настройки ниже:

Graylog - настройки input'а Syslog UDP

Graylog - настройки input’а Syslog UDP#

Добавить экстракторы#

После этого нужно добавить экстракторы c помощью кнопки Manage Extractors.

Ниже приложен JSON для импорта конфигурации:

{
  "extractors": [
    {
      "title": "Nginx Payload",
      "extractor_type": "regex_replace",
      "converters": [],
      "order": 0,
      "cursor_strategy": "copy",
      "source_field": "message",
      "target_field": "nginx_log_payload",
      "extractor_config": {
        "regex": "^(.*)\\{ (.*) \\}",
        "replacement": "{$2}",
        "replace_all": true
      },
      "condition_type": "none",
      "condition_value": ""
    },
    {
      "title": "Nginx JSON",
      "extractor_type": "json",
      "converters": [],
      "order": 0,
      "cursor_strategy": "cut",
      "source_field": "nginx_log_payload",
      "target_field": "",
      "extractor_config": {
        "list_separator": ", ",
        "kv_separator": "=",
        "key_prefix": "",
        "key_separator": "_",
        "replace_key_whitespace": false,
        "key_whitespace_replacement": "_"
      },
      "condition_type": "none",
      "condition_value": ""
    },
    {
      "title": "Cut www",
      "extractor_type": "regex_replace",
      "converters": [],
      "order": 0,
      "cursor_strategy": "cut",
      "source_field": "host",
      "target_field": "http_host",
      "extractor_config": {
        "replacement": "$2",
        "regex": "^(www\\.)?(.*)$"
      },
      "condition_type": "none",
      "condition_value": ""
    }
  ],
  "version": "4.0.6"
}