使用熊猫读取Cloudfront日志

时间:2020-04-14 17:27:01

标签: python pandas amazon-cloudfront

我想调用pd.read_table()来摄取由Amazon Cloudfront生成的日志,这些日志的格式设置为扩展日志文件(ELF)。

前两行如下所示:

#Version: 1.0
#Fields: date time x-edge-location sc-bytes c-ip cs-method cs(Host) cs-uri-stem sc-status cs(Referer) cs(User-Agent) cs-uri-query cs(Cookie) x-edge-result-type x-edge-request-id x-host-header cs-protocol cs-bytes time-taken x-forwarded-for ssl-protocol ssl-cipher x-edge-response-result-type cs-protocol-version fle-status fle-encrypted-fields c-port time-to-first-byte x-edge-detailed-result-type sc-content-type sc-content-len sc-range-start sc-range-end

列名紧跟#Fields:

我知道我可以像这样pd.read_table(fname, header=1)

开始阅读第二行的标题

但是如何忽略#Fields:并在此之后开始阅读各列?我似乎无法从Pandas documentation中发现这一点。我是否缺少某些功能或该功能不存在?

0 个答案:

没有答案