Last active
January 19, 2016 20:14
-
-
Save alq666/cd0efcdbefa2063f1c84 to your computer and use it in GitHub Desktop.
Redshift analysis of ELB logs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE elb_logs ( | |
RequestTime DateTime encode lzo, | |
ELBName varchar(30) encode lzo, | |
RequestIP_Port varchar(50) encode lzo, | |
BackendIP_Port varchar(50) encode lzo, | |
RequestProcessingTime FLOAT encode bytedict, | |
BackendProcessingTime FLOAT encode bytedict, | |
ClientResponseTime FLOAT encode bytedict, | |
ELBResponseCode INTEGER encode lzo, | |
BackendResponseCode INTEGER encode lzo, | |
ReceivedBytes BIGINT encode lzo, | |
SentBytes BIGINT encode lzo, | |
Request varchar(32767) encode lzo, | |
UserAgent varchar(4095) encode lzo, | |
SSLCipher varchar(100) encode lzo, | |
SSLProtocol varchar(100) encode lzo | |
) | |
sortkey(RequestTime); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x <- read.csv('Code/elb-logs/minutely.csv', colClasses=c("POSIXct", "factor", "numeric", "numeric", "numeric", "numeric", "factor", "factor", "numeric", "numeric", "factor")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table elb_minutely | |
sortkey(minute) | |
as | |
select date_trunc('minute', requesttime) as minute, | |
elbname, | |
avg(requestprocessingtime) as req_time_a, | |
max(requestprocessingtime) as req_time_m, | |
avg(backendprocessingtime) as be_time_a, | |
max(backendprocessingtime) as be_time_m, | |
elbresponsecode as elb_status, | |
backendresponsecode as be_status, | |
sum(receivedbytes) as ingress, | |
sum(sentbytes) as egress, | |
sslprotocol | |
from elb_logs | |
group by minute, elbname, elb_status, be_status, sslprotocol; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment