File tree Expand file tree Collapse file tree 2 files changed +27
-24
lines changed Expand file tree Collapse file tree 2 files changed +27
-24
lines changed Original file line number Diff line number Diff line change @@ -149,8 +149,34 @@ func processLogs(conn *pgx.Conn) {
149149 }
150150}
151151
152+ var createTemplate = `
153+ create table if not exists "{{.Schema}}"."{{.Table}}"
154+ (
155+ id serial
156+ constraint nginx_pk
157+ primary key,
158+ time_local varchar(256),
159+ path text,
160+ ip varchar(256),
161+ remote_user varchar(256),
162+ remote_port int,
163+ time timestamp,
164+ user_agent text,
165+ user_id_got text,
166+ user_id_set text,
167+ request text,
168+ status int,
169+ body_bytes_sent int,
170+ request_time float,
171+ request_method varchar(128),
172+ server_name varchar(256),
173+ geoip_country_code varchar(256),
174+ http_referrer text
175+ );
176+ `
177+
152178func initDb (conn * pgx.Conn ) {
153- tmpl , err := template .ParseFiles ("nginx-table.sql" )
179+ tmpl , err := template .New ("nginx-table.sql" ). Parse ( createTemplate )
154180 if err != nil {
155181 panic (err )
156182 }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments