# Filter by campaign

**URL:** <https://discuss.elastic.co/t/filter-by-campaign/219795>\
**Category:** Kibana\
**Created:** [February 18, 2020, 1:30pm UTC](https://discuss.elastic.co/t/filter-by-campaign/219795 "2020-02-18T13:30:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farsad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/farsad/32/62612_2.png) [@Farsad](https://discuss.elastic.co/u/Farsad)\
**Post date:** [February 18, 2020, 1:30pm UTC](https://discuss.elastic.co/t/filter-by-campaign/219795/1 "2020-02-18T13:30:51Z")

</div>

Hi,

We are imported Nginx logs to elastic by Logstash to make an analytics panel in Kibana.  
We need to make a filter to filter results based on campaign ids that the user started to reach our app.  
As an example, a user comes to our app by "url?refid=reddit" by IP address x.x.x.x. the "?refid=reddit" get removed from the URL that passed to the browser by Nginx. user will continue using our app and answer a poll, that makes a request to our API but without "?refid=reddit". It logged into Nginx log like "/api/poll//answered". So, in this line of log, we don't know the campaign. but we have IP address of the user.

In Kibana we want to filter "/api/poll//answered" urls that started from our campaigns (e.g. reddit).

What is the best way to make it in Kibana? (or Logstash)

Thank you!

---

<div class="post-metadata">

**Author:** ![tims](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tims/32/46750_2.png) [@tims](https://discuss.elastic.co/u/tims)\
**Post date:** [February 18, 2020, 8:30pm UTC](https://discuss.elastic.co/t/filter-by-campaign/219795/2 "2020-02-18T20:30:15Z")

</div>

Hey @Farsad, this sounds like something you would have to tie together during data ingestion. Can you lookup the campaigns using the ip address from elasticsearch during ingest, and store them on the log as an array or object? Then you can filter in Kibana.

---

<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:** [March 17, 2020, 8:30pm UTC](https://discuss.elastic.co/t/filter-by-campaign/219795/3 "2020-03-17T20:30:20Z")

</div>

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