# Input S3 does NOT work properly with prefix option

**URL:** <https://discuss.elastic.co/t/input-s3-does-not-work-properly-with-prefix-option/196426>\
**Category:** Logstash\
**Created:** [August 23, 2019, 1:39am UTC](https://discuss.elastic.co/t/input-s3-does-not-work-properly-with-prefix-option/196426 "2019-08-23T01:39:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasony](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jasony](https://discuss.elastic.co/u/jasony)\
**Post date:** [August 23, 2019, 1:39am UTC](https://discuss.elastic.co/t/input-s3-does-not-work-properly-with-prefix-option/196426/1 "2019-08-23T01:39:32Z")

</div>

Hello,

I am trying to set up a logstash pipeline with input source AWS S3. I set up as below and tested, and saw all log files were successfully retrieved by logstash. but only problem was from using "prefix" option.

```
input {
  s3 {
    bucket => "xxx"
    region => "xxx"
    access_key_id => "xxx"
    secret_access_key => "xxx"
    id => "xxx"
    **prefix =>**"sample-log/E1GL1WCR8XPQ2H*"
    type => "s3"
  }
# stdin {}
}

```

the source S3 structure looks attached image (I captured from AWS console).

 ![1](https://us1.discourse-cdn.com/elastic/original/3X/e/3/e30e96571886048dd7c33b1e493f7b8b68711fae.jpeg)

I put prefix option as above but got INFO line as below. It seemed logstash couldn't find file with prefix.

`[2019-08-23T01:30:25,410][INFO][logstash.inputs.s3] S3 input: No files found in bucket {:prefix=>"sample-log/E1GL1WCR8XPQ2H*"}`

was my above input code something wrong?

the log file from S3 should be indexed into ES based on the prefix of the log file name.

please advise.

thank you!

**[I am using Logstash 6.8.2]**

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 23, 2019, 1:56pm UTC](https://discuss.elastic.co/t/input-s3-does-not-work-properly-with-prefix-option/196426/2 "2019-08-23T13:56:03Z")

</div>

The prefix should [not](https://github.com/logstash-plugins/logstash-input-s3/blob/ba9b5fcbf1b1dd29122087c3b9aaace0ea531ae7/lib/logstash/inputs/s3.rb#L35) be a regexp. I believe the trailing \* is implied.

---

<div class="post-metadata">

**Author:** ![jasony](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jasony](https://discuss.elastic.co/u/jasony)\
**Post date:** [August 26, 2019, 2:00am UTC](https://discuss.elastic.co/t/input-s3-does-not-work-properly-with-prefix-option/196426/3 "2019-08-26T02:00:56Z")

</div>

thank you for your reply. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 23, 2019, 2:06am UTC](https://discuss.elastic.co/t/input-s3-does-not-work-properly-with-prefix-option/196426/4 "2019-09-23T02:06:52Z")

</div>

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