From 78af58cfd32e3f9e7cd5c36716fd2d971e01102b Mon Sep 17 00:00:00 2001
From: Oscar Najera <hi@oscarnajera.com>
Date: Sun, 27 Apr 2025 22:35:56 +0200
Subject: parsing apache logs

---
 webstats/logs.sql | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 webstats/logs.sql

(limited to 'webstats/logs.sql')

diff --git a/webstats/logs.sql b/webstats/logs.sql
new file mode 100644
index 0000000..9b5146b
--- /dev/null
+++ b/webstats/logs.sql
@@ -0,0 +1,27 @@
+-- name: create-log-table
+CREATE TABLE IF NOT EXISTS logs (
+    ip text,
+    remote_log text,
+    userid text,
+    date integer,
+    request_method text,
+    path text,
+    version text,
+    status integer,
+    length integer,
+    referrer text,
+    user_agent text)
+
+-- name: create-agent-table
+CREATE TABLE IF NOT EXISTS agent (
+    id integer PRIMARY KEY,
+    user_agent text UNIQUE)
+
+-- name: create-ip-table
+CREATE TABLE IF NOT EXISTS ip (
+    id integer PRIMARY KEY,
+    addr text UNIQUE)
+
+-- name: insert-log
+INSERT INTO logs (ip, remote_log, userid, date, request_method, path, version, status, length, referrer, user_agent)
+    VALUES (?ip, ?remote_log, ?userid, ?date, ?request_method, ?path, ?version, ?status, ?length, ?referrer, ?user_agent)
-- 
cgit v1.2.3

