|
|
@@ -38,15 +38,15 @@ if (length(ips) > 0) |
|
|
|
dbWriteTable(conn = db, name = "geoip", value = ., append = T) |
|
|
|
} |
|
|
|
|
|
|
|
src_sqlite("access.db") %>% |
|
|
|
db %>% |
|
|
|
tbl("access") %>% |
|
|
|
collect %>% |
|
|
|
left_join(geoip, by = c("ip" = "query")) %>% |
|
|
|
select(-null1, -user, -zone, -size, -null2, -as, -countryCode, -org, -region, -regionName, -status.y, -timezone, -zip, -isp) %>% |
|
|
|
mutate(timestamp = timestamp %>% str_sub(2) %>% as.POSIXct(format = "%d/%b/%Y:%H:%M:%S"), |
|
|
|
req = req %>% str_replace("(HEAD|GET|POST) ", ""), |
|
|
|
req = req %>% str_replace("/(.*?/).*", "\\1")) -> geoaccess |
|
|
|
|
|
|
|
leaflet(data = geoaccess) %>% |
|
|
|
left_join(db %>% tbl("geoip")) %>% |
|
|
|
collect -> geoaccess |
|
|
|
|
|
|
|
geoaccess %>% |
|
|
|
filter(status != 404, |
|
|
|
!agent %>% str_detect("bot")) %>% |
|
|
|
distinct(ip, lon, lat) %>% |
|
|
|
leaflet %>% |
|
|
|
addProviderTiles(providers$CartoDB.Positron) %>% |
|
|
|
addMarkers(~lon, ~lat, clusterOptions = markerClusterOptions()) |