centos

Filebeat在CentOS上的实时数据处理

小樊
47
2025-09-30 18:23:01
栏目: 智能运维

Installing Filebeat on CentOS
To begin using Filebeat for real-time data processing on CentOS, you first need to install it. The most common method is via the official Elastic YUM repository, which ensures you get the latest stable version. Here’s how:

  1. Update your system: sudo yum update -y.
  2. Add the Elastic GPG key and repository:
    sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
    echo "[elasticsearch-7.x]
    name=Elasticsearch repository for 7.x packages
    baseurl=https://artifacts.elastic.co/packages/7.x/yum
    gpgcheck=1
    gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
    enabled=1
    autorefresh=1
    type=rpm-md" | sudo tee -a /etc/yum.repos.d/elasticsearch.repo
    
  3. Install Filebeat: sudo yum install filebeat -y.
    This installs Filebeat with default configurations, ready for customization.

Configuring Filebeat for Real-Time Data Collection
The core of Filebeat’s real-time functionality lies in its configuration file (/etc/filebeat/filebeat.yml). Key settings include:

Starting and Enabling Filebeat
After configuring, start the Filebeat service and enable it to launch at boot:

sudo systemctl start filebeat
sudo systemctl enable filebeat

Verify the service is running: sudo systemctl status filebeat (look for “active (running)” in the output).

Verifying Real-Time Data Transmission
To confirm Filebeat is sending data in real time:

  1. Check Elasticsearch Indices: Run curl -X GET "localhost:9200/_cat/indices?v" (replace localhost if needed). You should see indices named filebeat-YYYY.MM.DD (e.g., filebeat-2025.09.30).
  2. Use Kibana for Visualization: If Kibana is installed, go to the Discover page, select the filebeat-* index pattern, and you’ll see real-time log entries as they’re sent by Filebeat.

Optional: Enhancing Real-Time Capabilities with Processors and Modules

Troubleshooting Tips

0
看了该问题的人还看了