如何检测U盘是否插入metricbeat或filebeat?

m1m5dgzv  于 2021-06-15  发布在  ElasticSearch
关注(0)|答案(1)|浏览(291)

我需要检测U盘是否插入metricbeat或filebeat以将此报告给elasticsearch服务器。
我需要这两个windows和linux。有什么想法吗?

kmbjn2e3

kmbjn2e31#

使用filebeat,只需指定 log 输入usb磁盘卷的路径:

- type: log

  # Change to true to enable this input configuration.
  enabled: true

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
   # On Mac
   - /Volumes/MY_USB_DISK/*.*
   # On Linux
   - /mnt/usb/*.*
   # On Windows (pick the right drive letter on which the USB disk is mounted)
   - F:\*.*

  fields:
    source: usb

然后你可以启动filebeat,一旦usb盘被插入,filebeat就会开始跟踪与上面路径匹配的所有文件,并将它们发送到es。

相关问题