# Use Logstash for execute enrich policy with HTTP output

**URL:** <https://discuss.elastic.co/t/use-logstash-for-execute-enrich-policy-with-http-output/294975>\
**Category:** Logstash\
**Created:** [January 20, 2022, 4:34pm UTC](https://discuss.elastic.co/t/use-logstash-for-execute-enrich-policy-with-http-output/294975 "2022-01-20T16:34:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GinkoLucas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ginkolucas/32/107055_2.png) [@GinkoLucas](https://discuss.elastic.co/u/GinkoLucas)\
**Post date:** [January 20, 2022, 4:34pm UTC](https://discuss.elastic.co/t/use-logstash-for-execute-enrich-policy-with-http-output/294975/1 "2022-01-20T16:34:28Z")

</div>

Hello,

I need to schedule the execution of an enrich policy. I think i can use Logstash for that, with an HTTP output.

Actualy, i have a Logstash who send data to Elasticsearch from Mysql Database. These data are going to be used for enrich other data.  
So, i think it can be cool to execute my enrich policy just after sending my data with Logstash.

There is my conf :

```auto
input {
  jdbc {
    jdbc_driver_library => "D:\Beat\Logstash\Logstash_Enrich\connecteurs\mysql-connector-java-5.1.49.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
	jdbc_connection_string => "jdbc:mysql://Mysql:3306/tools?useSSL=true&requireSSL=true"
    jdbc_user => "xxxxxxxx"
    jdbc_password => "xxxxxxxxx"
# schedule => "* * * * * *"
	statement => "
	SELECT xxxx
	FROM xxx 
	"
  }
}
filter {
}
output {
    stdout {
        codec => rubydebug
    }
	elasticsearch {
		hosts => ["https://myelk:9200"]
		index => "myindex"
		action =>"update"
		doc_as_upsert => true
		document_id=>"myid"
		user => "aSuperCoolUser"
		password => "xxxxxxx"
	}
	http {
		http_method=> "put"
		url=>	"https://myuser:mypassword@myelk:9243/_enrich/policy/enrich_policy_test002/_execute"
	}
}

```

The elasticsearch Output run correcty. But a have an error related to my HTTP output :

> [HTTP Output Failure] Encountered non-2xx HTTP code 400

Is other informations needed ? How can i solve this error ?

---

<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:** [February 17, 2022, 4:35pm UTC](https://discuss.elastic.co/t/use-logstash-for-execute-enrich-policy-with-http-output/294975/2 "2022-02-17T16:35:18Z")

</div>

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