首页 > 系统相关 >ubuntu22.04 部署filebeat 8.7

ubuntu22.04 部署filebeat 8.7

时间:2023-04-11 17:24:54浏览次数:47  
标签:paths filebeat log 8.7 ubuntu22.04 nginx usr local

下载filebeat

# curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.7.0-linux-x86_64.tar.gz

创建数据目录

# mkdir -pv /data/apps/filbeat/{data,logs}

安装filebeat

# tar xzvf filebeat-8.7.0-linux-x86_64.tar.gz -C /usr/local/
# ln -sv /usr/local/filebeat-8.7.0-linux-x86_64 /usr/local/filebeat

filebeat.service

[Unit]
Description=Filebeat sends log files to Logstash or directly to Elasticsearch.
Documentation=https://www.elastic.co/beats/filebeat
Wants=network-online.target
After=network-online.target

[Service]

UMask=0027
Environment="GODEBUG='madvdontneed=1'"
Environment="BEAT_LOG_OPTS="
Environment="BEAT_CONFIG_OPTS=-c /usr/local/filebeat/filebeat.yml"
Environment="BEAT_PATH_OPTS=--path.home /usr/local/filebeat --path.config /usr/local/filebeat --path.data /data/apps/filebeat/data --path.logs /data/apps/filebeat/logs"
ExecStart=/usr/local/filebeat/filebeat --environment systemd $BEAT_LOG_OPTS $BEAT_CONFIG_OPTS $BEAT_PATH_OPTS
Restart=always

[Install]
WantedBy=multi-user.target

filebeat.yml

filebeat.inputs:
- type: filestream 
  enabled: true
  id: my-filestream-id
  paths:
    - /var/log/system.log
    - /var/log/wifi.log
    
- type: filestream 
  enabled: true
  id: apache-filestream-id
  paths:
    - "/var/log/apache2/*"
  fields:
    apache: true

filebeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: true

  # Period on which files under path should be checked for changes
  #reload.period: 10s

output.elasticsearch:
  hosts: ["https://myEShost:9200"]
  username: "filebeat_internal"
  password: "YOUR_PASSWORD" 
  ssl:
    enabled: true
    ca_trusted_fingerprint: "b9a10bbe64ee9826abeda6546fc988c8bf798b41957c33d05db736716513dc9c"

setup.kibana:
  host: "mykibanahost:5601" 
  username: "my_kibana_user"  
  password: "{pwd}"

收集数据模块

查看可用的模块

# filebeat modules list

启用模块

# /usr/local/filebeat/filebeat modules enable nginx
Enabled nginx

修改nginx模块

# cat modules.d/nginx.yml
# Module: nginx
# Docs: https://www.elastic.co/guide/en/beats/filebeat/master/filebeat-module-nginx.html

- module: nginx
  # Access logs
  access:
    enabled: true

    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths: ["/var/log/nginx/access.log*"]

  # Error logs
  error:
    enabled: true

    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths: ["/var/log/nginx/access.log*"]

  # Ingress-nginx controller logs. This is disabled by default. It could be used in Kubernetes environments to parse ingress-nginx logs
  ingress_controller:
    enabled: false

    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    #var.paths:

 

参考文档

https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation-configuration.html

标签:paths,filebeat,log,8.7,ubuntu22.04,nginx,usr,local
From: https://www.cnblogs.com/wangguishe/p/17306645.html

相关文章

  • ubuntu22.04 安装中文字体
    安装中文字体sudoapt-getinstallttf-wqy-microhei#文泉驿-微米黑sudoapt-getinstallttf-wqy-zenhei#文泉驿-正黑sudoapt-getinstallxfonts-wqy#文泉驿-点阵宋体vimrc#cat/etc/vim/vimrc....setfileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936set......
  • ubuntu22.04 添加开机启动脚本
    在目录/etc/init.d/目录新建脚本sudovim/etc/init.d/startup.sh#!/bin/bash#Onlyfortesttouch/root/1.txt添加执行权限sudochmod+x/etc/init.d/startup.sh添加启动脚本sudoupdate-rc.dstartup.shdefaults90查看服务列表sudoservice--status-all测试是......
  • Ubuntu22.04办公环境初始设置记录
    1前言这周末刚从Windows办公环境切换到Ubuntu22.04,有些东西还是比较折腾,记录一下便于以后查找。2.安装时的分区设置从一块完整的新硬盘安装Ubuntu单系统时,只需要以下分区:ESP分区(EFISystemPartition),设为200MB即可,是GPT分区表存储的位置。UEFI引导的系统都需要这个分区。......
  • OS-Linux-Ubuntu22.04x64-Python-C++调用Python缺少Python.h
    OS-Linux-Ubuntu22.04x64-Python-C++调用Python缺少Python.h使用C或C++扩展Python扩展和嵌入Python解释器Python3.10.11Python/CAPI参考手册Python3.11.3Python/CAPI参考手册参考https://www.cnblogs.com/lidabo/p/17043302.htmlhttps://blog.csdn.net/z......
  • ubuntu22.04 部署 Auditd
    安装Auditd#apt-yinstallauditdauditd.conf##Thisfilecontrolstheconfigurationoftheauditdaemon#local_events=yeswrite_logs=yeslog_file=/var/log/audit/audit.log#指定日志文件log_group=admlog_format=ENRICHEDflush=INCREMENTA......
  • 虚拟机ubuntu22.04搭建esp-matter环境
    一. 安装esp-idfStep1:编译ESP-IDF需要以下软件包。请根据使用的Linux发行版本,选择合适的安装命令。Ubuntu和Debian: sudoapt-getinstallgitwgetflexbisongperfpython3python3-venvpython3-setuptoolscmakeninja-buildccachelibffi-devlibssl-devdf......
  • windows下elk安装配置-elasticsearch/kibana/filebeat
    以8.6.2为例,下载地址elasticsearch:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.6.2-windows-x86_64.zipkibana:https://artifacts.elastic.co/downloads/kibana/kibana-8.6.2-windows-x86_64.zipfilebeat:https://artifacts.elastic.co/downloads/beats......
  • Ubuntu22.04Linux安装手册
    Ubuntu22.04系统ISO镜像下载https://mirrors.aliyun.comLive-server-amd64#服务器isoDesktop-amd64#桌面isoInstallUbuntu22.04使用安装介质启动系统当系统使用......
  • ubuntu22.04下安装nvidia-docker
    首先需要保证dockerengine已经安装成功,具体见:https://www.cnblogs.com/devilmaycry812839668/p/17269122.html  ======================================  nvi......
  • 使用 Filebeat 监听日志文件
    Filebeat是一个日志文件托运工具,在你的服务器上安装客户端后,filebeat会监控日志目录或者指定的日志文件,追踪读取这些文件(追踪文件的变化,不停的读),并且转发这些信息到elastic......