ATS 5.3.0日志字段分析(续)

自定义日志域Custom Logging Fields
下面的字段描述了ATS支持的自定义日志域
{HTTP header field name}cqh
{HTTP header field name}pqh
{HTTP header field name}psh
{HTTP header field name}ssh

{HTTP header field name}cssh

参见下面的示意图:


这里UA表示user-agent,也就是client,P/C表示Proxy/Cache,如果Cache中就直接返回,如果没有就回源;OS表示original server,也就是源站。


下面是ATS 5.3.0源码中支持的日志字段及其含义
// client -> proxy fields
chi    client_host_ip
chp    client_host_port
chih   client_host_ip_hex
caun   client_auth_user_name
piid   plugin_identity_id
pitag  plugin_identity_tag
cqts   client_req_timestamp_sec
cqth   client_req_timestamp_hex_sec
cqtq   client_req_timestamp_squid
cqtn   client_req_timestamp_netscape
cqtd   client_req_timestamp_date
cqtt   client_req_timestamp_time
cqtx   client_req_text
cqhm   client_req_http_method
cqu    client_req_url
cquuc   client_req_unmapped_url_canonical
cquup  client_req_unmapped_url_path
cquuh  client_req_unmapped_url_host
cqus   client_req_url_scheme
cqup   client_req_url_path
cqhv   client_req_http_version
cqhl   client_req_header_len
cqbl   client_req_body_len
cfsc   client_finish_status_code

// proxy -> client fields
psct    proxy_resp_content_type
psql    proxy_resp_squid_len
pscl    proxy_resp_content_len
psch    proxy_resp_content_len_hex
pshl    proxy_resp_header_len
pssc    proxy_resp_status_code
pfsc    proxy_finish_status_code
crc     cache_result_code
chm     cache_hit_miss

// proxy -> server fields
pqhl    proxy_req_header_len
pqbl    proxy_req_body_len
pqsn    proxy_req_server_name
pqsi    proxy_req_server_ip
phr     proxy_hierarchy_route
phn     proxy_host_name
phi     proxy_host_ip
php     proxy_host_port

// server -> proxy fields
shi     server_host_ip
shn     server_host_name
sssc    server_resp_status_code
sscl    server_resp_content_len
sshl    server_resp_header_len
sshv    server_resp_http_version
stms    server_resp_time
stmsh   server_resp_time_hex
stmsf   server_resp_time_fractional
sts     server_resp_time_sec

// cache -> client
csssc   cached_resp_status_code
csscl   cached_resp_content_len
csshl   cached_resp_header_len
csshv   cached_resp_http_version
crat    client_retry_after_time
cwr     cache_write_result
cwtr    cache_write_transform_result

// other fields
ttms    transfer_time_ms
ttmh    transfer_time_ms_hex
ttmsf   transfer_time_ms_fractional
tts     transfer_time_sec

fsiz    file_size

LogField切片(Slicing)
有时候想切割一个LogField去限制给定LogField的输出长度。
LogField切片有如下规范:
普通类型 %<field[start:end]> 
容器类型 %<{field}container[start:end]>
如果忽略切片符号,就是默认取整个log field
切片符号只能应用于string类型的log field,不能应用于ip/timestamp类型,虽然它们能从整数转换为字符串类型

下面是允许的切片规范
[start:end]  取log field的值,从start到end-1
[start:]   取log field的值,从start到余下的字符串
[:end]   去log field的值,从开头到end-1
[:]   默认取整个log field

下面是一些例子
'%<cqup>'       //the whole characters of <cqup>.
'%<cqup>[:]'    //the whole characters of <cqup>.
'%<cqup[0:30]>' //the first 30 characters of <cqup>.
'%<cqup[-10:]>' //the last 10 characters of <cqup>.
'%<cqup[:-5]>'  //everything except the last 5 characters of <cqup>.

参考文献
[1].http://trafficserver.readthedocs.org/en/latest/admin/event-logging-formats.en.html
[2].proxy/logging/Log.h/cc源码

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值