# How to check client\_ip ipv4 or ipv6?

**URL:** https://discuss.elastic.co/t/how-to-check-client-ip-ipv4-or-ipv6/240654
**Category:** Logstash
**Created:** [July 10, 2020, 7:56am UTC](https://discuss.elastic.co/t/how-to-check-client-ip-ipv4-or-ipv6/240654 "2020-07-10T07:56:22Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [July 10, 2020, 5:27pm UTC](https://discuss.elastic.co/t/how-to-check-client-ip-ipv4-or-ipv6/240654/3 "2020-07-10T17:27:14Z")

</div>

Not convinced a length check will work. What about :: or ::1, which are valid V6 addresses but short? Perhaps check

```
if [client_ip] =~ /:/

```

V6 addresses are delimited using colon, V4 addresses using a period.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-check-client-ip-ipv4-or-ipv6/240654)._
