I am trying to find the IP address of the HTTP request sender (using Logstash HTTP input plugin) in logstash.
curl -XPUT 'http://127.0.0.1:8080/twitter/tweet/1' -d 'hello'
My config file for logstash is:
input {
http {
host => "127.0.0.1"
port => "8080"
}
}
filter {
geoip {
source => #I want the IP of the sender here
target => "geoip"
database => "/home/gourab/logstash-5.2.2/GeoIP2-City.mmdb"
add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}" ]
}
mutate {
convert => [ "[geoip][coordinates]", "float"]
}
}
output {
stdout { codec => rubydebug }
elasticsearch {
hosts => ["192.168.1.193:9200"]
action => "index"
index => "temp_load_index"
}
}