How to handle rotating directory in input file for logstash

Hi Team,

I wants logstash to read logs from AWS S3 bucket but my log path directory is keep rotating on month basis and am not understand how to handle it. please suggest.

input {
      s3 {
          "access_key_id" => "***"
          "secret_access_key" => "***"
          "bucket" => "org"
          "prefix" => "org_2022/ourorg/20220201-20220301/"
          "region" => "us-north-1"
            }
          }

Presuming the 20220201-20220301 part is what rotates it should work by specifying the prefix as
org_2022/ourorg/; It will retrieve all files below it I believe.

Hi, Yes. "20220201-20220301" is that directory and change on every month basis, under this directory logs are written. like below :
"org_2022/ourorg/20220201-20220301/ourorg.logs".

Then this should work:

input {
      s3 {
          "access_key_id" => "***"
          "secret_access_key" => "***"
          "bucket" => "org"
          "prefix" => "org_2022/ourorg/"
          "region" => "us-north-1"
            }
          }
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.