# Create map visualizsation of alb logs data

**URL:** https://discuss.elastic.co/t/create-map-visualizsation-of-alb-logs-data/224283
**Category:** Logstash
**Created:** [March 19, 2020, 3:15pm UTC](https://discuss.elastic.co/t/create-map-visualizsation-of-alb-logs-data/224283 "2020-03-19T15:15:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vinayak\_k\_g](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@vinayak\_k\_g](https://discuss.elastic.co/u/vinayak_k_g)
#### Post date: [March 19, 2020, 3:15pm UTC](https://discuss.elastic.co/t/create-map-visualizsation-of-alb-logs-data/224283/1 "2020-03-19T15:15:51Z")

</div>

Hi  
We have setup alb logs to show on our kibana dashboards successfully so far. Now we want to map the geography data.  
Have followed [this article](https://discuss.elastic.co/t/how-can-i-plot-google-map-with-long-and-lat/91647/8) created the geo field but the data shown for geo ip is 0,0.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/5/554ef6f06c57bec25e5e8a120ce8a0eca4297429.jpeg)

Please let us know what is missed here and what we can do.  
I am attaching the logstash.conf for the sake of completeness.  
And the mapping and also the log sample.

```
input {
s3 {
    bucket => "elb-logs"
    type => "alb"
    add_field => {
        "doctype" => "aws-application-load-balancer"
        "es_index" => "alb-logs"
    }
}
beats {
    port => "9600"
}
}

# Filter for parsing our ALB logs
filter {
if [type] == "alb" {
    grok {
    match => ["message", '%{DATA:request_type} %{TIMESTAMP_ISO8601:timestamp} %{NOTSPACE:alb_resource_id} %{IP:client_ip}:%{NUMBER:client_port} (?:%{IP:target_ip}:%{NUMBER:target_port}|-) %{NUMBER:request_processing_time} %{NUMBER:target_processing_time} %{NUMBER:response_processing_time} (?:%{NUMBER:elb_status_code}|-) (?:%{NUMBER:target_status_code}|-) %{NUMBER:received_bytes} %{NUMBER:sent_bytes} \"(?:%{WORD:verb}|-) (?:%{GREEDYDATA:request}|-) (?:HTTP/%{NUMBER:httpversion}|-( )?)\" \"%{DATA:userAgent}\"( %{NOTSPACE:ssl_cipher} %{NOTSPACE:ssl_protocol})? %{NOTSPACE:target_group_arn}? \"%{NOTSPACE:trace_id}\" \"%{NOTSPACE:domain_name}\" \"%{NOTSPACE:chosen_cert_arn}\" %{NOTSPACE:matched_rule_priority} %{TIMESTAMP_ISO8601:request_creation_time} \"%{NOTSPACE:actions_executed}\" \"%{DATA:redirect_url}\" \"%{NOTSPACE:error_reason}\" \"%{DATA:target_port_list}\" \"%{DATA:target_status_code_list}\"']
	}
    grok {
        match => ["request", "%{URIPROTO:http_protocol}"]
    }
    if [request] != "-" {
         grok {
             match => ["request", "(?<request>[^?]*)"]
             overwrite => ["request"]
         }
    }
    useragent {
        source => "userAgent"
    }
    date {
        match => ["timestamp", "ISO8601"]
    }
    geoip {
        source => "client_ip"
    }
    mutate { add_field => { 'geo' => ['%{[geoip.latitude]}', '%{[geoip.longitude}'] } }
    mutate { convert => {
      '[geo][0]' => 'float'
      '[geo][1]' => 'float'
      }
   }
}

}

output {
    elasticsearch {
        hosts => ["http://localhost:9200"]
        index => "ab c-%{+YYYY.MM.dd}"
    }
}

```

Mapping is attached here (without the geo field)

```auto
{
  "alb-logs-2020.02.25": {
    "mappings": {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "@version": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "alb_resource_id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "build": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "client_ip": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "client_port": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "device": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "doctype": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "elb_status_code": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "es_index": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "geoip": {
          "properties": {
            "city_name": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "continent_code": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "country_code2": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "country_code3": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "country_name": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "dma_code": {
              "type": "long"
            },
            "ip": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "latitude": {
              "type": "float"
            },
            "location": {
              "properties": {
                "lat": {
                  "type": "float"
                },
                "lon": {
                  "type": "float"
                }
              }
            },
            "longitude": {
              "type": "float"
            },
            "postal_code": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "region_code": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "region_name": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "timezone": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            }
          }
        },
        "http_protocol": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "httpversion": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "major": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "received_bytes": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "request": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "request_processing_time": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "request_type": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "response_processing_time": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "sent_bytes": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "ssl_cipher": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "ssl_protocol": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "tags": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "target_ip": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "target_port": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "target_processing_time": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "target_status_code": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "timestamp": {
          "type": "date"
        },
        "type": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "userAgent": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "verb": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
  }
}

```

---

<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: [April 16, 2020, 3:15pm UTC](https://discuss.elastic.co/t/create-map-visualizsation-of-alb-logs-data/224283/2 "2020-04-16T15:15:55Z")

</div>

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