A shiny app to explore nginx access logs and geolocate the connections
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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())