filebeat开启自带模块收集日志如何辨别日志来源等

filebeat启动自带模块后,日志先输出到Redis中
比如开启了system模块日志和redis模块日志
在Redis中查看收集过来的日志时,可以看到如下的这些信息
system日志信息

{
  "@timestamp": "2019-09-02T04:10:20.423Z",
  "@metadata": {
    "beat": "filebeat",
    "type": "_doc",
    "version": "7.3.0",
    "pipeline": "filebeat-7.3.0-system-syslog-pipeline"
  },
  "ecs": {
    "version": "1.0.1"
  },
  "host": {
    "os": {
      "name": "CentOS Linux",
      "kernel": "3.10.0-957.21.3.el7.x86_64",
      "codename": "Core",
      "platform": "centos",
      "version": "7 (Core)",
      "family": "redhat"
    },
    "id": "35a7a3c7af8f44188f7095d5291a188e",
    "containerized": false,
    "name": "bogon",
    "hostname": "bogon",
    "architecture": "x86_64"
  },
  "service": {
    "type": "system"
  },
  "input": {
    "type": "log"
  },
  "event": {
    "module": "system",
    "dataset": "system.syslog",
    "timezone": "+08:00"
  },
  "fileset": {
    "name": "syslog"
  },
  "agent": {
    "hostname": "bogon",
    "id": "a44c8bbc-723c-4982-84f8-bad50c80fac9",
    "version": "7.3.0",
    "type": "filebeat",
    "ephemeral_id": "50725221-8fe5-48be-af66-89e43fadf1c2"
  },
  "log": {
    "offset": 21029,
    "file": {
      "path": "/var/log/messages"
    }
  },
  "message": "Sep  2 12:10:10 bogon filebeat: 2019-09-02T12:10:10.357+0800#011INFO#011crawler/crawler.go:139#011Stopping Crawler"
}

redis日志信息

{
  "@timestamp": "2019-09-02T05:33:45.984Z",
  "@metadata": {
    "beat": "filebeat",
    "type": "_doc",
    "version": "7.3.0",
    "pipeline": "filebeat-7.3.0-redis-log-pipeline"
  },
  "service": {
    "type": "redis"
  },
  "host": {
    "hostname": "bogon",
    "architecture": "x86_64",
    "os": {
      "codename": "Core",
      "platform": "centos",
      "version": "7 (Core)",
      "family": "redhat",
      "name": "CentOS Linux",
      "kernel": "3.10.0-957.21.3.el7.x86_64"
    },
    "id": "35a7a3c7af8f44188f7095d5291a188e",
    "containerized": false,
    "name": "bogon"
  },
  "agent": {
    "hostname": "bogon",
    "id": "a44c8bbc-723c-4982-84f8-bad50c80fac9",
    "version": "7.3.0",
    "type": "filebeat",
    "ephemeral_id": "50725221-8fe5-48be-af66-89e43fadf1c2"
  },
  "ecs": {
    "version": "1.0.1"
  },
  "event": {
    "dataset": "redis.log",
    "module": "redis"
  },
  "fileset": {
    "name": "log"
  },
  "input": {
    "type": "log"
  },
  "log": {
    "offset": 21001,
    "file": {
      "path": "/var/log/redis/redis_6379.log"
    }
  },
  "message": "1812:M 02 Sep 2019 13:33:45.068 * Background saving started by pid 2682"
}

根据下图所示,有两处地方可以用来判断来源
可以根据这俩的不同在logstash中判断来源,进而在elasticsearch中生成不同的索引
794174-20190902145338174-793714446.png

转载于:https://www.cnblogs.com/sanduzxcvbnm/p/11446554.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值