# Apache Log and \_geoip\_lookup\_failure error

**URL:** <https://discuss.elastic.co/t/apache-log-and-geoip-lookup-failure-error/114679>\
**Category:** Logstash\
**Created:** [January 9, 2018, 10:14am UTC](https://discuss.elastic.co/t/apache-log-and-geoip-lookup-failure-error/114679 "2018-01-09T10:14:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssppune](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@ssppune](https://discuss.elastic.co/u/ssppune)\
**Post date:** [January 9, 2018, 10:14am UTC](https://discuss.elastic.co/t/apache-log-and-geoip-lookup-failure-error/114679/1 "2018-01-09T10:14:47Z")

</div>

## I am using Apache behind HAProxy. The sample log file is as follows

194.1.143.146, 10.80.4.30 - - [13/Dec/2017:15:08:12 +0530] "GET /Portal/themes/js/language/showjs.js HTTP/1.1" 200 7106 "[https://myserver.com/search/?searchElement=soccer&language=en](https://myserver.com/search/?searchElement=soccer&language=en)" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"

* * *

The first IP is Client IP and second IP is HAproxy IP. I have noticed that because of presence of comma charater after ClientIP,  
the error \_geoip\_lookup\_failure is appearing. The X-Forwarded-For option in HAProxy provides comma separated IP addresses to Apache Log file. I want to filter this (,) character before index creation.  
How can I filter this Comma charter so that geoip can get value after index creation?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 9, 2018, 10:53am UTC](https://discuss.elastic.co/t/apache-log-and-geoip-lookup-failure-error/114679/2 "2018-01-09T10:53:19Z")

</div>

What does your current Logstash configuration look like?

---

<div class="post-metadata">

**Author:** ![ssppune](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@ssppune](https://discuss.elastic.co/u/ssppune)\
**Post date:** [January 9, 2018, 11:29am UTC](https://discuss.elastic.co/t/apache-log-and-geoip-lookup-failure-error/114679/3 "2018-01-09T11:29:00Z")

</div>

## Here is content of "/usr/share/logstash/logstash.conf " file

* * *

## input { beats { port =\> 5443 ssl =\> true ssl\_certificate =\> "/etc/pki/tls/certs/logstash-forwarder.crt" ssl\_key =\> "/etc/pki/tls/private/logstash-forwarder.key" } } filter { grok { match =\> { "message" =\> "%{COMBINEDAPACHELOG}" } } geoip { source =\> "clientip" target =\> "geoip" database =\> "/etc/logstash/GeoLite2-City.mmdb" add\_field =\> ["[geoip][coordinates]", "%{[geoip][longitude]}" ] add\_field =\> ["[geoip][coordinates]", "%{[geoip][latitude]}" ] add\_tag =\> "geo\_point" } mutate { convert =\> ["[geoip][coordinates]", "float"] } } output { elasticsearch { hosts =\> ["localhost:9200"] manage\_template =\> false index =\> "%{[@metadata][beat]}-%{+YYYY.MM.dd}" document\_type =\> "%{[@metadata][type]}" } stdout { codec =\> rubydebug } }

and apache-filter.conf is as follows

* * *

filter {  
grok {  
match =\> {  
"message" =\> "%{COMBINEDAPACHELOG}"  
}  
}  
geoip {  
source =\> "clientip"  
target =\> "geoip"  
database =\> "/etc/logstash/GeoLite2-City.mmdb"  
add\_field =\> ["[geoip][coordinates]", "%{[geoip][longitude]}" ]  
add\_field =\> ["[geoip][coordinates]", "%{[geoip][latitude]}" ]  
add\_tag =\> "geo\_point"  
}  
mutate {  
convert =\> ["[geoip][coordinates]", "float"]  
}  
}

* * *

Please note when I manually remove Comma(,) charater between two IPs, it works properly.

---

<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 6, 2018, 11:29am UTC](https://discuss.elastic.co/t/apache-log-and-geoip-lookup-failure-error/114679/4 "2018-02-06T11:29:21Z")

</div>

Closed on February 6, 2018, 11:29am UTC

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