如果消息与file_selectors不匹配,则将Filebeat配置为不删除AWS SQS消息



场景

AWS S3被配置为向SQS队列发送事件通知

Filebeat使用aws-s3-plugin通过SQS队列从S3提取日志

filebeat.inputs:
- type: aws-s3
queue_url: https://sqs.us-east-2.amazonaws.com/aws-id/queue-name
gzip: true
file_selectors:
- regex: '.*-mytype.log.*'

Filebeat删除队列中存在的所有消息,而它应该只处理和删除与file_selectorsregex 匹配的消息

问题:如何将filebeat配置为删除SQS队列消息如果消息与file_selectors正则表达式不匹配?

p.S.

我试图实现的用例是

  1. AWS S3通知->SQS队列(所有类型的文件(
  2. 使用同一队列配置的多个filebeat实例
    • Filebeat-1:为file_type_1配置file_selectors。filebeat输出:Logstash
    • Filebeat-2:为file_type_2配置file_selectors。filebeat输出:Elasticsearch

@snapper我认为使用单个SQS队列,配置不会以您希望的方式工作。每个filebeat输入将尝试从队列中读取所有消息,并使用file_selectors来决定下载哪些文件,但读取并忽略所有其他消息。

可以使用的模式是使用SNS和SQS的扇出。S3在上传文件时将事件发布到SNS。多个SQS队列订阅了SNS,每个队列对应于一个filebeat输入。https://docs.aws.amazon.com/sns/latest/dg/sns-sqs-as-subscriber.html

最新更新