From 12f9aec33862bc3314f4ebbf10dbbaaec8ece373 Mon Sep 17 00:00:00 2001 From: robertsweetman Date: Wed, 3 Jan 2024 13:12:13 +0000 Subject: [PATCH] Revert "remove sql create table as this manual step is no longer needed" This reverts commit 2fe90ed935a2778fc72186f8105c3c849407c2ca. --- templates/create_table.sql | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 templates/create_table.sql diff --git a/templates/create_table.sql b/templates/create_table.sql new file mode 100644 index 00000000..25476c6b --- /dev/null +++ b/templates/create_table.sql @@ -0,0 +1,36 @@ +CREATE EXTERNAL TABLE IF NOT EXISTS ${database}.lb_logs ( + type string, + time string, + elb string, + client_ip string, + client_port int, + target_ip string, + target_port int, + request_processing_time double, + target_processing_time double, + response_processing_time double, + elb_status_code string, + target_status_code string, + received_bytes bigint, + sent_bytes bigint, + request_verb string, + request_url string, + request_proto string, + user_agent string, + ssl_cipher string, + ssl_protocol string, + target_group_arn string, + trace_id string, + domain_name string, + chosen_cert_arn string, + matched_rule_priority string, + request_creation_time string, + actions_executed string, + redirect_url string, + new_field string + ) + ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe' + WITH SERDEPROPERTIES ( + 'serialization.format' = '1', + 'input.regex' = '([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*):([0-9]*) ([^ ]*)[:-]([0-9]*) ([-.0-9]*) ([-.0-9]*) ([-.0-9]*) (|[-0-9]*) (-|[-0-9]*) ([-0-9]*) ([-0-9]*) \"([^ ]*) ([^ ]*) (- |[^ ]*)\" \"([^\"]*)\" ([A-Z0-9-]+) ([A-Za-z0-9.-]*) ([^ ]*) \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" ([-.0-9]*) ([^ ]*) \"([^\"]*)\"($| \"[^ ]*\")(.*)') + LOCATION 's3://${bucket}/${application_name}/AWSLogs/${account_id}/elasticloadbalancing/${region}/';