<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          ES06# Filebeat采集原理與監(jiān)控指標梳理

          共 8022字,需瀏覽 17分鐘

           ·

          2022-05-10 15:53

          當Filebeat作為日志采集的agent鋪開時,對其自身agent的監(jiān)控以確保穩(wěn)定就尤為的重要,有幾種方式監(jiān)控agent運行。

          • 第一種 filebeat自己將監(jiān)控埋點上報
          • 第二種 filebeat暴露埋點接口,另外一個agent定時采集后上報

          第二種能夠監(jiān)測filebeat的進程狀況,例如官方提供的Metricbeat,也可以自己實現(xiàn)agent上報監(jiān)控指標。本文就其如何監(jiān)控Filebeat以及指標含義進行梳理,主要內(nèi)容有:

          • 一、filebeat日志采集原理
          • 二、filebeat暴露endpoint
          • 三、beat監(jiān)控指標
          • 四、filebeat監(jiān)控指標
          • 五、libbeat監(jiān)控指標
          • 六、監(jiān)控指標完整示例
          一、filebeat日志采集原理

          filebeat采集原理如下圖所示,數(shù)據(jù)流從左到右流轉(zhuǎn)。


          組件描述:

          Input:負責輸入源,每啟動一個文件會創(chuàng)建一個Harvester負責讀取

          Filebeat.Harvester:負責文件數(shù)據(jù)的讀取

          Filebeat.Registrar:負責記錄文件以及對應(yīng)的偏移量,記錄在registry/filebeat/log.json中,格式如下所示,filebeat啟動時會讀取該文件

          {"k":"filebeat::logs::native::4349261-16777229","v":{"id":"native::4349261-16777229","prev_id":"","source":"/Users/admin/logs/csp/sentinel-server.log","offset":1150,"type":"log","identifier_name":"native","timestamp":[2062583329080,1648206113],"ttl":-1,"FileStateOS":{"inode":4349261,"device":16777229}}}

          Libbeat.Pipeline:負責管理Harvester的寫入、緩存、輸出等,queue事件隊列(緩存or磁盤),acker輸出后的確認回調(diào)

          二、filebeat暴露endpoint

          1.HTTP endpoint

          在filebeat.yml文件中開啟http.enabled,默認端口為5066,本文將其修改成了5067。

          #Enable?the?HTTP?endpoint?to?allow?external?collection?of?monitoring?data
          http.enabled:?true
          http.port:?5067

          2.filebeat基本信息

          請求命令

          http://localhost:5067/?pretty

          返回示例

          {
          ??"beat":?"filebeat",
          ??"hostname":?"M-C02GL1NTQ05P",
          ??"name":?"M-C02GL1NTQ05P",
          ??"uuid":?"d9823622-46a6-4f4d-8dda-f2efeee82e35",
          ??"version":?"7.15.2"
          }

          指標說明

          指標說明
          beatbeat的類型,本文為filebeat
          hostname主機名稱
          uuidfilebeat的uuid
          versionfilebeat的版本

          另外下面命令返回了filebeat的眾多指標信息,下文中根據(jù)不同的類型分拆梳理走查。

          http://localhost:5067/stats?pretty

          三、beat監(jiān)控指標

          beat為通用模塊,filebeat繼承該模塊,側(cè)重于整體概覽。主要包括:基本信息、CPU運行狀態(tài)信息、緩存指標信息、運行時指標。

          1.基本信息

          返回示例

          "info":?{
          ??????"ephemeral_id":?"7ab1d8ba-098d-46a8-a116-bfc350493f40",
          ??????"uptime":?{
          ????????"ms":?623789
          ??????},
          ??????"version":?"7.15.2"
          ?}

          指標說明

          指標說明
          ephemeral_id臨時ID用于標識此agent,在重啟后會變化
          uptimeagent的運行時間
          versionagent的版本信息

          2.CPU運行狀態(tài)

          返回示例

          "cpu":?{
          ??????"system":?{
          ????????"ticks":?17,
          ????????"time":?{
          ??????????"ms":?737
          ????????}
          ??????},
          ??????"total":?{
          ????????"ticks":?34,
          ????????"time":?{
          ??????????"ms":?1464
          ????????},
          ????????"value":?34
          ??????},
          ??????"user":?{
          ????????"ticks":?17,
          ????????"time":?{
          ??????????"ms":?727
          ????????}
          ??????}
          ?}

          指標說明

          指標說明
          system.ticks運行CPU處于系統(tǒng)狀態(tài)的時間
          user.ticks運行CPU處于用戶狀態(tài)的時間
          total.ticks運行CPU處于系統(tǒng)狀態(tài)和用戶狀態(tài)總的時間

          3.緩存指標

          返回示例

          "memstats":?{
          ??"gc_next":?23418608,
          ??"memory_alloc":?16693968,
          ??"memory_sys":?76366856,
          ??"memory_total":?181068824,
          ??"rss":?46481408
          }

          指標說明

          指標說明
          gc_next下一次GC目標堆的大小
          memory_allocGo語言堆空間分配的字節(jié)數(shù)
          memory_sys服務(wù)當前使用系統(tǒng)的內(nèi)存大小
          memory_total服務(wù)運行至今總共分配的堆內(nèi)存大小(只遞增)
          rssResident Set Size(常駐內(nèi)存大小)表示進程使用了多少內(nèi)存

          4.運行時指標

          返回示例

          "runtime":?{
          ??"goroutines":?31
          }

          指標說明

          指標說明
          goroutines運行時調(diào)度管理“線程池”大小

          四、filebeat監(jiān)控指標

          1.events指標

          返回示例

          "events":?{
          ??????"active":?0,
          ??????"added":?3,
          ??????"done":?3
          ????}

          指標說明

          指標說明
          active正在活動事件的數(shù)量
          added已添加事件的數(shù)量
          done已完成事件的數(shù)量

          備注:通過events了解filebeat的吞吐情況。

          2.harvester指標

          返回示例

          "harvester":?{
          ??????"closed":?0,
          ??????"open_files":?0,
          ??????"running":?0,
          ??????"skipped":?0,
          ??????"started":?0
          ????}

          指標說明

          指標說明
          closedharvester已關(guān)閉的數(shù)量
          open_files已打開的文件數(shù)量
          running正在harvester的數(shù)量
          skippedharvester已忽略的數(shù)量
          startedharvester已啟動的數(shù)量

          備注:每個文件都會通過一個harvester讀取,通過harvester監(jiān)控讀取文件數(shù)量情況。

          3.input指標

          返回示例

          "input":?{
          ??????"log":?{
          ????????"files":?{
          ??????????"renamed":?0,
          ??????????"truncated":?0
          ????????}
          ??????},
          ??????"netflow":?{
          ????????"flows":?0,
          ????????"packets":?{
          ??????????"dropped":?0,
          ??????????"received":?0
          ????????}
          ??????}

          指標說明

          指標說明
          files.renamed被改名文件的數(shù)量
          files.truncated被截斷文件的數(shù)量
          netflow.flowsIP網(wǎng)絡(luò)流量統(tǒng)計
          packets.dropped丟棄的分組(packets)數(shù)量
          packets.received接受的分組(packets)數(shù)量

          備注:每個文件都會通過一個harvester讀取,通過harvester監(jiān)控讀取文件數(shù)量情況,netflow網(wǎng)絡(luò)數(shù)據(jù)包分析工具。


          五、libbeat監(jiān)控指標

          libbeat為公共模塊,filebeat繼承了該模塊。可以output的速率、pipeline中隊列積壓以及registrar記錄位移情況。

          1.config指標

          返回示例

          "config":?{
          ??????"module":?{
          ????????"running":?0,
          ????????"starts":?0,
          ????????"stops":?0
          ??????},
          ??????"reloads":?1,
          ??????"scans":?62
          ????}

          指標說明

          指標說明
          module.running正在運行組件的數(shù)量
          module.starts已啟動組件的數(shù)量
          module.stops已停止組件的數(shù)量
          reloads加載配置文件的數(shù)量
          scans掃描配置文件的數(shù)量

          2.output指標

          返回示例

          "output":?{
          ??????"events":?{
          ????????"acked":?0,
          ????????"active":?0,
          ????????"batches":?0,
          ????????"dropped":?0,
          ????????"duplicates":?0,
          ????????"failed":?0,
          ????????"toomany":?0,
          ????????"total":?0
          ??????},
          ??????"read":?{
          ????????"bytes":?0,
          ????????"errors":?0
          ??????},
          ??????"type":?"elasticsearch",
          ??????"write":?{
          ????????"bytes":?0,
          ????????"errors":?0
          ??????}
          ????}

          指標說明

          指標說明
          events.acked確認事件數(shù)量
          events.active活動事件數(shù)量
          events.dropped丟棄事件數(shù)量
          events.failed失敗事件數(shù)量
          read.bytes讀入的字節(jié)數(shù)
          write.bytes寫出的字節(jié)數(shù)

          3.pipeline指標

          返回示例

          "pipeline":?{
          ??????"clients":?1,
          ??????"events":?{
          ????????"active":?0,
          ????????"dropped":?0,
          ????????"failed":?0,
          ????????"filtered":?3,
          ????????"published":?0,
          ????????"retry":?0,
          ????????"total":?3
          ??????},
          ??????"queue":?{
          ????????"acked":?0,
          ????????"max_events":?4096
          ??????}
          ????}

          指標說明

          指標說明
          clients連接到pipeline的client數(shù)量
          queue.ackedqueue中已被output確認的數(shù)量
          queue.max_eventsqueue中存儲事件的最大數(shù)量

          備注:Filebeat使用內(nèi)部queue存儲publishing前的事件,這些事件會被outputs消費。

          4.registrar指標

          返回示例

          "registrar":?{
          ????"states":?{
          ??????"cleanup":?0,
          ??????"current":?3,
          ??????"update":?3
          ????},
          ????"writes":?{
          ??????"fail":?0,
          ??????"success":?3,
          ??????"total":?3
          ????}
          ??}

          指標說明

          指標說明
          states.cleanup被清理registrar的數(shù)量
          states.current正在運行registrar的數(shù)量
          states.update已更新registrar的數(shù)量
          writes.fail寫入registry文件失敗的數(shù)量
          writes.success寫入registry文件成功的數(shù)量

          備注:registrar會記錄日志文件采集的位移。

          5.CPU負載指標

          返回示例

          "system":?{
          ????"cpu":?{
          ??????"cores":?8
          ????},
          ????"load":?{
          ??????"1":?2.749,
          ??????"15":?2.5459,
          ??????"5":?2.5659,
          ??????"norm":?{
          ????????"1":?0.3436,
          ????????"15":?0.3182,
          ????????"5":?0.3207
          ??????}
          ????}

          指標說明

          指標說明
          coresCPU核數(shù)
          loadCPU負載

          六、監(jiān)控指標完整示例

          指標端點

          http://localhost:5067/stats?pretty

          返回示例

          {
          ??"beat":?{
          ????"cpu":?{
          ??????"system":?{
          ????????"ticks":?17,
          ????????"time":?{
          ??????????"ms":?737
          ????????}
          ??????},
          ??????"total":?{
          ????????"ticks":?34,
          ????????"time":?{
          ??????????"ms":?1464
          ????????},
          ????????"value":?34
          ??????},
          ??????"user":?{
          ????????"ticks":?17,
          ????????"time":?{
          ??????????"ms":?727
          ????????}
          ??????}
          ????},
          ????"info":?{
          ??????"ephemeral_id":?"7ab1d8ba-098d-46a8-a116-bfc350493f40",
          ??????"uptime":?{
          ????????"ms":?623789
          ??????},
          ??????"version":?"7.15.2"
          ????},
          ????"memstats":?{
          ??????"gc_next":?23418608,
          ??????"memory_alloc":?16693968,
          ??????"memory_sys":?76366856,
          ??????"memory_total":?181068824,
          ??????"rss":?46481408
          ????},
          ????"runtime":?{
          ??????"goroutines":?31
          ????}
          ??},
          ??"filebeat":?{
          ????"events":?{
          ??????"active":?0,
          ??????"added":?3,
          ??????"done":?3
          ????},
          ????"harvester":?{
          ??????"closed":?0,
          ??????"open_files":?0,
          ??????"running":?0,
          ??????"skipped":?0,
          ??????"started":?0
          ????},
          ????"input":?{
          ??????"log":?{
          ????????"files":?{
          ??????????"renamed":?0,
          ??????????"truncated":?0
          ????????}
          ??????},
          ??????"netflow":?{
          ????????"flows":?0,
          ????????"packets":?{
          ??????????"dropped":?0,
          ??????????"received":?0
          ????????}
          ??????}
          ????}
          ??},
          ??"libbeat":?{
          ????"config":?{
          ??????"module":?{
          ????????"running":?0,
          ????????"starts":?0,
          ????????"stops":?0
          ??????},
          ??????"reloads":?1,
          ??????"scans":?62
          ????},
          ????"output":?{
          ??????"events":?{
          ????????"acked":?0,
          ????????"active":?0,
          ????????"batches":?0,
          ????????"dropped":?0,
          ????????"duplicates":?0,
          ????????"failed":?0,
          ????????"toomany":?0,
          ????????"total":?0
          ??????},
          ??????"read":?{
          ????????"bytes":?0,
          ????????"errors":?0
          ??????},
          ??????"type":?"elasticsearch",
          ??????"write":?{
          ????????"bytes":?0,
          ????????"errors":?0
          ??????}
          ????},
          ????"pipeline":?{
          ??????"clients":?1,
          ??????"events":?{
          ????????"active":?0,
          ????????"dropped":?0,
          ????????"failed":?0,
          ????????"filtered":?3,
          ????????"published":?0,
          ????????"retry":?0,
          ????????"total":?3
          ??????},
          ??????"queue":?{
          ????????"acked":?0,
          ????????"max_events":?4096
          ??????}
          ????}
          ??},
          ??"registrar":?{
          ????"states":?{
          ??????"cleanup":?0,
          ??????"current":?3,
          ??????"update":?3
          ????},
          ????"writes":?{
          ??????"fail":?0,
          ??????"success":?3,
          ??????"total":?3
          ????}
          ??},
          ??"system":?{
          ????"cpu":?{
          ??????"cores":?8
          ????},
          ????"load":?{
          ??????"1":?2.749,
          ??????"15":?2.5459,
          ??????"5":?2.5659,
          ??????"norm":?{
          ????????"1":?0.3436,
          ????????"15":?0.3182,
          ????????"5":?0.3207
          ??????}
          ????}
          ??}
          }

          備注:官方參考文檔

          https://www.elastic.co/guide/en/beats/filebeat/current/http-endpoint.html

          #?Monitor?Filebeat
          https://www.elastic.co/guide/en/beats/filebeat/current/monitoring.html#monitoring

          #?Filebeat?internal?collection
          https://www.elastic.co/guide/en/beats/filebeat/current/configuration-monitor.html

          #?Metricbeat?collection
          https://www.elastic.co/guide/en/beats/filebeat/current/monitoring-metricbeat-collection.html
          瀏覽 98
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  欧美性猛交XXXX乱大交3 99精品视频在线播放免费 | 国产六区色婷婷 | 大香蕉免费中文 | 诱惑无码一区二区三区 | 亚洲国产欧美日韩在线观看 |