ATS 5.3.0日志字段分析(续)
下面的字段描述了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切片有如下規(guī)范:
普通類型 %<field[start:end]>?
容器類型 %<{field}container[start:end]>
如果忽略切片符號,就是默認取整個log field
切片符號只能應(yīng)用于string類型的log field,不能應(yīng)用于ip/timestamp類型,雖然它們能從整數(shù)轉(zhuǎn)換為字符串類型
下面是允許的切片規(guī)范
[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源碼
總結(jié)
以上是生活随笔為你收集整理的ATS 5.3.0日志字段分析(续)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ATS插件channel_stats源码
- 下一篇: ATS 5.3.0中自定义日志格式文件l