Import access.csv into sqlite3 db
This commit is contained in:
parent
c1cabf167b
commit
278049a95b
1 changed files with 11 additions and 2 deletions
|
@ -421,11 +421,17 @@ write_files:
|
|||
# Increase history limit
|
||||
set -g history-limit 50000
|
||||
|
||||
- path: /home/cl/nginx_logs.sql
|
||||
- path: /home/cl/access_logs.sql
|
||||
owner: 'cl:cl'
|
||||
defer: True
|
||||
content: |
|
||||
CREATE TABLE nginx_logs (
|
||||
-- commands.sql
|
||||
|
||||
-- Set the mode to CSV to properly import CSV files
|
||||
.mode csv
|
||||
|
||||
-- If the table doesn't exist, create it
|
||||
CREATE TABLE IF NOT EXISTS access_logs (
|
||||
timestamp TEXT,
|
||||
ip_address TEXT,
|
||||
remote_user TEXT,
|
||||
|
@ -436,6 +442,9 @@ write_files:
|
|||
http_user_agent TEXT
|
||||
);
|
||||
|
||||
-- Import the data into the 'access_logs' table
|
||||
.import '/var/log/nginx/access.csv' access_logs
|
||||
|
||||
- path: /home/cl/setup_sbcl.sh
|
||||
owner: 'cl:cl'
|
||||
permission: '0755'
|
||||
|
|
Loading…
Add table
Reference in a new issue