【发布时间】:2019-04-09 12:01:44
【问题描述】:
这是我第一次尝试雅典娜,请温柔:)
此查询没有因错误而失败 -> 没有可行的替代方案
CREATE EXTERNAL TABLE IF NOT EXISTS dev.mytokendata (
'dateandtime' timestamp, 'requestid' string,
'ip' string, 'caller' string, 'token' string, 'requesttime' int,
'httpmethod' string, 'resourcepath' string, 'status' smallint,
'protocol' string, 'responselength' int )
ROW FORMAT SERDE 'com.amazonaws.glue.serde.GrokSerDe'
WITH SERDEPROPERTIES (
'input.format'='%{TIMESTAMP_ISO8601:dateandtime}
\s+\{\"requestId\":\s+\"%{USERNAME:requestid}\",
\s+\"ip\":\s+\"%{IP:ip}\",
\s+\"caller\":\s+\"%{USERNAME:caller}\",
\s+\"token\":\s+\"%{USERNAME:token}\",
\s+\"requestTime\":\s+\"%{INT:requesttime}\",
\s+\"httpMethod\":\s+\"%{WORD:httpmethod}\",
\s+\"resourcePath\":\s+\"%{UNIXPATH:resourcepath}\",
\s+\"status\":\s+\"%{INT:status}\",
\s+\"protocol\":\s+\"%{UNIXPATH:protocol}\",
\s+\"responseLength:\"\s+\"%{INT:responselength}\"\s+\}' )
STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION 's3://athena-abc/1234/'
TBLPROPERTIES ('has_encrypted_data'='false', 'compressionType'='gzip');
这是我尝试解析的日志文件中的一行(.gz 文件)
2018-07-30T02:23:34.134Z { "requestId":
"810000-9100-1100-a100-f100000", "ip": "01.01.01.001", "caller": "-",
"token": "1234-5678-78910-abcd", "requestTime":
"1002917414000", "httpMethod": "POST", "resourcePath":
"/MyApp/v1.0/MyService.wsdl",
"status": "200", "protocol": "HTTP/1.1", "responseLength": "1000" }
谁能指出可能出了什么问题?会有很大帮助的
【问题讨论】:
标签: amazon-web-services amazon-s3 logstash-grok amazon-athena