# Logstash conditional elasticsearch output plugin depends on success of S3 output plugin

**URL:** <https://discuss.elastic.co/t/logstash-conditional-elasticsearch-output-plugin-depends-on-success-of-s3-output-plugin/256800>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [November 26, 2020, 4:49pm UTC](https://discuss.elastic.co/t/logstash-conditional-elasticsearch-output-plugin-depends-on-success-of-s3-output-plugin/256800 "2020-11-26T16:49:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abolurah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abolurah/32/68804_2.png) [@Abolurah](https://discuss.elastic.co/u/Abolurah)\
**Post date:** [November 26, 2020, 4:49pm UTC](https://discuss.elastic.co/t/logstash-conditional-elasticsearch-output-plugin-depends-on-success-of-s3-output-plugin/256800/1 "2020-11-26T16:49:19Z")

</div>

Hi All,  
In my Logstash configuration, I have 2 output plugins, one is S3 and another is Elasticsearch.  
My goal is to send logs to S3 and update the same logs with "uploadStatus = finished", everything works fine until I have a network issue, and S3 plugin did not send logs successfully, but Elasticsearch plugin updated logs as successful.  
May I somehow run the Elasticsearch output plugin only when the S3 output plugin succeeded uploading?

I must say that with the Amazon\_es output plugin there is the exact behavior I want to achieve (if amazon\_es plugin fails, elasticsearch plugin not executed ) .

```
output { 
    
    stdout { codec => rubydebug { metadata => true	} }
		 
    s3{
           access_key_id => "${Logstash__AwsAccessKey}"
		   secret_access_key => "${Logstash__AwsSecretKey}"
           region => "${Logstash__AwsRegion}"
           bucket => "${Logstash__AwsS3TargetBucket}"   
           size_file => "${Logstash__AwsS3Size_File}"
           time_file => "${Logstash__AwsS3Time_File}" 
           codec => "json_lines"
           prefix => "${Logstash __AwsS3Prefix}/${Logstash__ Device_Id}/%{[@metadata][_index]}"
           validate_credentials_on_root_bucket => "${Logstash__AwsValidate_Credentials_On_Root_Bucket}"
           proxy_uri => "${Logstash__Http_Proxy}"
           retry_count => 0
           retry_delay => 0
           upload_queue_size => 1
        }

     elasticsearch {
                  hosts => "${Logstash__SourceEs_Url}" 
                  index => "%{[@metadata][_index]}"
                  document_id => "%{[@metadata][_id]}"
                  action => "update"
                  script => "ctx._source.uploadStatus = 'finished'"
                }

```

}

---

<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 24, 2020, 4:49pm UTC](https://discuss.elastic.co/t/logstash-conditional-elasticsearch-output-plugin-depends-on-success-of-s3-output-plugin/256800/2 "2020-12-24T16:49:20Z")

</div>

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