如何通过处理器限制日志记录级别?

时间:2019-05-28 15:06:48

标签: elasticsearch logstash logstash-configuration elastic-beats

我使用journalbeatjournald事件发送到logstash(然后最终传递给elasticsearch)。我只对优先级更高的消息感兴趣。

在我的journalbeat.yml文件的最顶部

processors:
 - drop_event:
     when:
        range:
          syslog.priority.gte: 5

我的意图是(在所有事件上)运行处理器,该处理器将丢弃syslog.priority字段大于或等于5(=丢弃debug和{{1})的事件}消息。

这显然不起作用,因为我看到诸如

之类的消息
info
被发送到elasticsearch(然后我通过kibana看到)。请注意

{
  "_index": "journalbeat-7.1.0-2019.05.28-000001",
  "_type": "_doc",
  "_id": "mlHv_moBGanrPHbULpIO",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2019-05-28T14:54:07.866Z",
    "systemd": {
      "slice": "system.slice",
      "unit": "docker.service",
      "transport": "stdout",
      "cgroup": "/system.slice/docker.service",
      "invocation_id": "6b251fbc93814b26b857e33f79f261d2"
    },
    "ecs": {
      "version": "1.0.0"
    },
    "agent": {
      "ephemeral_id": "468fbf6d-8a90-47d2-8aff-a65d77c316c2",
      "hostname": "srv",
      "id": "c0526522-ca71-4a2a-a0e5-aa33f1e7c76e",
      "version": "7.1.0",
      "type": "journalbeat"
    },
    "message": "time=\"2019-05-28T16:54:07.866182040+02:00\" level=info msg=\"NetworkDB stats srv(cc5972674014) - netID:gpnvf5y5wthv491ypvpzunbot leaving:false netPeers:1 entries:2 Queue qLen:0 netMsg/s:0\"",
    "journald": {
      "custom": {
        "stream_id": "2e5695063ac54814a73ca48966594789",
        "selinux_context": "unconfined\n"
      }
    },
    "event": {
      "created": "2019-05-28T14:54:07.907Z"
    },
    "host": {
      "architecture": "x86_64",
      "hostname": "srv",
      "id": "77c0caf0e493e9cd0f7c689856d9e916",
      "boot_id": "a51ba1fe7c884be685c53329db0f036b",
      "name": "srv",
      "os": {
        "codename": "bionic",
        "platform": "ubuntu",
        "version": "18.04.2 LTS (Bionic Beaver)",
        "family": "debian",
        "name": "Ubuntu",
        "kernel": "4.15.0-50-generic"
      },
      "containerized": false
    },
    "syslog": {
      "facility": 3,
      "priority": 6,
      "identifier": "dockerd"
    },
    "process": {
      "pid": 7607,
      "name": "dockerd",
      "uid": 0,
      "cmd": "/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375",
      "executable": "/usr/bin/dockerd-ce",
      "capabilites": "3fffffffff"
    }
  },
  "fields": {
    "@timestamp": [
      "2019-05-28T14:54:07.866Z"
    ],
    "event.created": [
      "2019-05-28T14:54:07.907Z"
    ]
  },
  "sort": [
    1559055247866
  ]
}

部分,然后在基巴纳语中将其解析为 "syslog": { "facility": 3, "priority": 6, "identifier": "dockerd" },

处理器应如何连接到“所有事件”?

0 个答案:

没有答案