# How can I add the request IP address to every document?

**URL:** https://discuss.elastic.co/t/how-can-i-add-the-request-ip-address-to-every-document/239112
**Category:** Elasticsearch
**Created:** [June 29, 2020, 12:42pm UTC](https://discuss.elastic.co/t/how-can-i-add-the-request-ip-address-to-every-document/239112 "2020-06-29T12:42:29Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)
#### Post date: [June 30, 2020, 4:38am UTC](https://discuss.elastic.co/t/how-can-i-add-the-request-ip-address-to-every-document/239112/4 "2020-06-30T04:38:38Z")

</div>

Hi,

I am not sure this is possible: In theory, you would have to create an ingest pipeline in ElasticSearch which does what you want and modify your REST call to execute the pipeline. But from what I found there is no processor for adding the IP from the REST call. See [here](https://github.com/elastic/elasticsearch/issues/27312) for the Github issue.  
Depending on the usecase this might also be problematic as the IP adress can be faked.

I guess you have (at least) 3 options depending on your infrastructure:  
Option 1: Alter your REST call to include the IP adress out of the box  
Option 2: Switch from a direct REST call to ElasticSearch to LogStash. LogStash supports [this](https://discuss.elastic.co/t/how-to-get-the-ip-address-of-the-http-request-sender-using-logstash/78891/8).  
Option 3: This is not exactly what you asked for as it does not directly give you the IP. You may use the [set-security-user-processor](https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ingest-node-set-security-user-processor.html) to get the informationabout the user/apiKey which was used to write send the document. If each server has a separate user/apiKey you can use this information to uniquely identify the sending server(You may then use a mapping to get the IP based on the server but it is not the same as getting the IP of the server obviously)

Best regards  
Wolfram

---

_[View the full topic](https://discuss.elastic.co/t/how-can-i-add-the-request-ip-address-to-every-document/239112)._
