# Flag traffic from Tor exit nodes

**URL:** <https://discuss.elastic.co/t/flag-traffic-from-tor-exit-nodes/44938>\
**Category:** Logstash\
**Created:** [March 21, 2016, 1:44am UTC](https://discuss.elastic.co/t/flag-traffic-from-tor-exit-nodes/44938 "2016-03-21T01:44:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [March 21, 2016, 1:44am UTC](https://discuss.elastic.co/t/flag-traffic-from-tor-exit-nodes/44938/1 "2016-03-21T01:44:02Z")

</div>

I'm looking to flag any traffic hitting our edge that appears to come from a tor exit node.

I've pulled a list of all exit nodes, which I'll later cron updates to, with:

```
curl -s https://check.torproject.org/exit-addresses | awk '/ExitAddress/ {print $2": Torified"}'

```

Then I'm planning to add a translate filter to check the exit list, and mutate that into a tag:

```
translate {
  field => "client_ip"
  destination => "tor_status"
  dictionary_path => "/etc/logstash/torexits.dict"
}
if [tor_status] {
  mutate {
    add_tag => "torified"
    remove_field => "tor_status"
  }
}

```

This works, but it seems a bit messy. On the other hand I'm not sure I want an array with 1000+ IPs sitting in my logstash config. It would make scheduled updates to the list trickier, too, requiring both templating and a restart.

Is there a way to check whether a field's contents exist in a list and, if so, add a tag... without adding unnecessary logic and without writing the list into config?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 21, 2016, 2:44am UTC](https://discuss.elastic.co/t/flag-traffic-from-tor-exit-nodes/44938/2 "2016-03-21T02:44:02Z")

</div>

You could add in an `exec` input to do the curl into the translate file every so often too.

But until dynamic reloading gets released (5.0 I think?), this is the best way.

---

<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:** [July 6, 2017, 5:06am UTC](https://discuss.elastic.co/t/flag-traffic-from-tor-exit-nodes/44938/3 "2017-07-06T05:06:10Z")

</div>

Closed on July 6, 2017, 5:06am UTC


