
Untitled
By: a guest on
May 3rd, 2012 | syntax:
None | size: 0.67 KB | hits: 45 | expires: Never
regex for access log in hive serde
66.249.68.6 - - [14/Jan/2012:06:25:03 -0800] "GET /example.com HTTP/1.1" 200 708 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
CREATE TABLE access_log (
remote_ip STRING,
request_date STRING,
method STRING,
request STRING,
protocol STRING
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe'
WITH SERDEPROPERTIES (
"input.regex" = "([^ ]) . . [([^]]+)] "([^ ]) ([^ ]) ([^ "])" *",
"output.format.string" = "%1$s %2$s %3$s %4$s %5$s"
)
STORED AS TEXTFILE;
"input.regex" = "([0-9]+.[0-9]+.[0-9]+.[0-9]+)[^[]+[([^]]+)][^/]+([^ ]+).+"
"output.format.string" = "%1$s %2$s %3$s"