|
|
@@ -3,16 +3,16 @@ library(RSQLite) |
|
|
|
library(ipapi) |
|
|
|
library(leaflet) |
|
|
|
|
|
|
|
# sqlite3 access.db |
|
|
|
# create table access(ip, null1, user, timestamp, zone, req, status, size, referer, agent, null2); |
|
|
|
# .separator " " |
|
|
|
# .import access.log access |
|
|
|
|
|
|
|
dbConnect(SQLite(), "access.db") %>% |
|
|
|
dbGetQuery("delete from access where ip = '192.168.0.254' or user = 'maxx' or agent like '%bot%' or ip = '164.2.255.244';") |
|
|
|
|
|
|
|
dbConnect(SQLite(), "access.db") %>% |
|
|
|
dbGetQuery("vacuum;") |
|
|
|
dbConnect(SQLite(), "access.db") -> db |
|
|
|
|
|
|
|
read_delim("access.log", delim = " ", col_names = c("ip", "null1", "user", "timestamp", "zone", "req", "status", "size", "referer", "agent", "null2")) %>% |
|
|
|
mutate_all(na_if, "-") %>% |
|
|
|
filter(user %>% is.na) %>% |
|
|
|
filter(!ip %in% c("192.168.0.254", "164.2.255.244")) %>% |
|
|
|
mutate(timestamp = timestamp %>% as.POSIXct(format = "[%d/%b/%Y:%H:%M:%S")) %>% |
|
|
|
separate(req, into = c("method", "url", "version"), sep = " ") %>% |
|
|
|
select(ip, timestamp, url, status, referer, agent) %>% |
|
|
|
dbWriteTable(conn = db, name = "access", value = ., append = T) |
|
|
|
|
|
|
|
known_ips <- character(0) |
|
|
|
|
|
|
|