Scripts2026年7月17日·1 分钟阅读

Filebeat — Lightweight Log Shipper from the Elastic Stack

A lightweight agent that reads log files, containers, and cloud services, then forwards structured events to Elasticsearch, Logstash, or any supported output for centralized observability.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Filebeat Overview
先审查命令
npx -y tokrepo@latest install ee448910-819a-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

Filebeat is a lightweight, open-source log shipper maintained by Elastic as part of the Beats family. It tails log files, collects container logs, and reads cloud audit trails, then delivers structured events to Elasticsearch, Logstash, Kafka, or Redis with minimal resource overhead.

What Filebeat Does

  • Tails log files and tracks read offsets for reliable at-least-once delivery
  • Ships container logs from Docker and Kubernetes via autodiscovery
  • Provides 60-plus pre-built modules for Nginx, Apache, MySQL, AWS, and more
  • Applies multiline joining, JSON parsing, and field enrichment before output
  • Integrates with Elastic Agent for unified fleet management

Architecture Overview

Filebeat runs one or more harvesters, each responsible for reading a single file and sending events to a central spooler. The spooler batches events and forwards them to the configured output (Elasticsearch, Logstash, Kafka). A registry file persists read offsets so Filebeat resumes from the correct position after restarts. Back-pressure handling pauses harvesting when the output is saturated.

Self-Hosting and Configuration

  • Install via package managers (apt, yum), Docker images, or standalone archives
  • Edit filebeat.yml to define inputs, modules, and output destinations
  • Enable modules with filebeat modules enable <name> for pre-configured dashboards
  • Use Autodiscover with Docker or Kubernetes for dynamic container log collection
  • Deploy as a DaemonSet in Kubernetes for per-node log collection

Key Features

  • Single-binary Go application with a small memory footprint (typically 30-50 MB)
  • Built-in modules provide ready-made parsing, dashboards, and ML jobs
  • Supports multiple outputs simultaneously via Logstash fan-out
  • Processors pipeline allows filtering, enrichment, and conditional routing
  • Internal queue with configurable memory or disk-backed buffering

Comparison with Similar Tools

  • Fluentd — more flexible with a plugin ecosystem but heavier on resources; Filebeat is lighter for pure log shipping
  • Fluent Bit — similarly lightweight with broader input/output options but less integrated with Elastic dashboards
  • Promtail — Loki-focused log agent; Filebeat targets Elasticsearch and the broader Elastic ecosystem
  • Vector — high-performance Rust-based pipeline; Filebeat has tighter Elastic integration and pre-built modules

FAQ

Q: Does Filebeat guarantee no log loss? A: Filebeat provides at-least-once delivery by persisting file offsets in a registry. Duplicate events are possible on unclean shutdowns.

Q: Can I use Filebeat without Elasticsearch? A: Yes. Filebeat can output to Logstash, Kafka, Redis, or any compatible endpoint.

Q: How does Filebeat handle log rotation? A: It detects renamed or truncated files and opens new harvesters as needed, continuing to track offsets by file identity (inode).

Q: What is the difference between Filebeat and Elastic Agent? A: Elastic Agent is a unified agent that can run Filebeat, Metricbeat, and other Beats internally, managed via Fleet. Standalone Filebeat is simpler for single-purpose log collection.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产