# Can i define S3 output file content?

**URL:** <https://discuss.elastic.co/t/can-i-define-s3-output-file-content/192351>\
**Category:** Logstash\
**Created:** [July 26, 2019, 4:29am UTC](https://discuss.elastic.co/t/can-i-define-s3-output-file-content/192351 "2019-07-26T04:29:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandonbai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandonbai/32/42842_2.png) [@brandonbai](https://discuss.elastic.co/u/brandonbai)\
**Post date:** [July 26, 2019, 4:29am UTC](https://discuss.elastic.co/t/can-i-define-s3-output-file-content/192351/1 "2019-07-26T04:29:52Z")

</div>

Hi,

When I use the following code to remove the message field,

```auto
filter {
....

 if "_grokparsefailure" not in [tags] {
    mutate {
      remove_field => ["message"]
    }
  }
....
}

```

the log content output to s3 becomes the following content:

`2019-07-26T02:38:56.000Z {name=f2b7eda7958a} %{message}`

From this I guess the s3 plugin will only get and output the message field.

Is there any way to make:

1. The content output to elasticsearch does not contain the message field;
2. The content output to s3 contains only the message field

logstash version: 6.6.0

Thanks!

---

<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:** [July 26, 2019, 12:43pm UTC](https://discuss.elastic.co/t/can-i-define-s3-output-file-content/192351/2 "2019-07-26T12:43:32Z")

</div>

> [@brandonbai](#):
>
> 2019-07-26T02:38:56.000Z {name=f2b7eda7958a} %{message}

That's the output from event.to\_s, which is what the line codec [uses](https://github.com/logstash-plugins/logstash-codec-line/blob/d4734598a8c1e944f97ed1acafc03e3e1fc66feb/lib/logstash/codecs/line.rb#L49) if you do not supply a format. So supply a format...

```
output { s3 { codec => line { format => "..." ...

```

---

<div class="post-metadata">

**Author:** ![brandonbai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandonbai/32/42842_2.png) [@brandonbai](https://discuss.elastic.co/u/brandonbai)\
**Post date:** [July 27, 2019, 1:38am UTC](https://discuss.elastic.co/t/can-i-define-s3-output-file-content/192351/3 "2019-07-27T01:38:17Z")

</div>

Hi Badger,

As you said, I also saw the relevant introduction in the [official document](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-s3.html#plugins-outputs-s3-common-options).

Thanks!

---

<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:** [August 24, 2019, 1:38am UTC](https://discuss.elastic.co/t/can-i-define-s3-output-file-content/192351/4 "2019-08-24T01:38:36Z")

</div>

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