A shiny app to explore nginx access logs and geolocate the connections
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
534B

  1. library(tidyverse)
  2. library(leaflet)
  3. src_sqlite("access.db") %>%
  4. tbl("access") %>%
  5. left_join(src_sqlite("access.db") %>% tbl("geoip")) %>%
  6. collect %>%
  7. mutate(timestamp = timestamp %>% as.POSIXct(origin = "1970-01-01")) %>%
  8. mutate_at(vars(city, country, agent), factor) -> geoaccess
  9. geoaccess %>%
  10. filter(status != 404,
  11. !agent %>% str_detect("bot")) %>%
  12. distinct(ip, lon, lat) %>%
  13. leaflet %>%
  14. addProviderTiles(providers$CartoDB.Positron) %>%
  15. addMarkers(~lon, ~lat, clusterOptions = markerClusterOptions())