# S3 input plugin - add path field, preserve folder hierarchy during backup?

**URL:** <https://discuss.elastic.co/t/s3-input-plugin-add-path-field-preserve-folder-hierarchy-during-backup/156259>\
**Category:** Logstash\
**Created:** [November 12, 2018, 9:20am UTC](https://discuss.elastic.co/t/s3-input-plugin-add-path-field-preserve-folder-hierarchy-during-backup/156259 "2018-11-12T09:20:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GitSpree23](https://avatars.discourse-cdn.com/v4/letter/g/65b543/32.png) [@GitSpree23](https://discuss.elastic.co/u/GitSpree23)\
**Post date:** [November 12, 2018, 9:20am UTC](https://discuss.elastic.co/t/s3-input-plugin-add-path-field-preserve-folder-hierarchy-during-backup/156259/1 "2018-11-12T09:20:45Z")

</div>

While pushing logs from local to ES using `file` input plugin, a `path` field gets added which contains the actual path of the log file which the document was created from.  
But this field doesn't show up when using the AWS `s3` input plugin. How do I add it?

Also, I have set the `backup_to_dir` to a parent folder which contains sub-folders. Eg. :

1. 

```
   /p_dir

```

2. 

```
       /dir1

```

3. 

```
              log0

```

4. 

```
              log1

```

5. 

```
              log 2

```

6. 

```
       /dir2

```

7. 

```
              log0

```

8. 

```
              log1

```

In this case, I am facing an error during backup.

Please help me resolve these issues.

My s3 input plugin:

```
s3 {
                "access_key_id" => "***"
                "secret_access_key" => "***"
                "backup_to_dir" => "/home/xyz/aws_s3_backup_data/"
                "bucket" => "bucket1"
                "prefix" => "bucket1a/p_dir/"
        }
```

---

<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:** [December 10, 2018, 9:20am UTC](https://discuss.elastic.co/t/s3-input-plugin-add-path-field-preserve-folder-hierarchy-during-backup/156259/2 "2018-12-10T09:20:46Z")

</div>

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