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.

13 lines
518B

  1. library(tidyverse)
  2. library(ipapi)
  3. system("grep GraphTV /var/log/nginx/access.log | grep -vi bot | cut -d ' ' -f 1 | sort | uniq", intern = T) -> ips
  4. read_delim("/var/log/nginx/access.log", delim = " ", col_names = c("ip", "null", "user", "timestamp", "zone", "req", "status", "size", "referer", "agent")) %>%
  5. select(-null, -user, -zone, -size) %>%
  6. mutate(timestamp = timestamp %>% str_sub(2) %>% as.POSIXct(format = "%d/%b/%Y:%H:%M:%S")) %>%
  7. mutate_at(vars(status), factor) -> access
  8. geolocate(ips) -> geoip