加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 如何基于XID过滤清漆日志?

发布时间:2020-12-14 02:28:39 所属栏目:Linux 来源:网络整理
导读:我遇到了罕见的503错误,这些错误很难确定. Varnishlog让我发疯,因为我似乎无法获得我想要的信息. 我希望看到Varnish看到的客户端和后端通信.我认为在Varnish的默认错误页面上记录的XID号码将允许我从日志记录缓冲区中过滤出确切的请求.但是,没有varnishlog参
我遇到了罕见的503错误,这些错误很难确定. Varnishlog让我发疯,因为我似乎无法获得我想要的信息.

我希望看到Varnish看到的客户端和后端通信.我认为在Varnish的默认错误页面上记录的XID号码将允许我从日志记录缓冲区中过滤出确切的请求.但是,没有varnishlog参数的组合可以为我提供所需的输出.

以下仅显示客户端通信:

varnishlog -d -c -m ReqStart:1427305652

虽然这只显示了后端通信:

varnishlog -d -b -m TxHeader:1427305652

是否有单行显示整个请求?

解决方法

因为在与客户端通信时,XID也出现在TxHeader标记行中:
12 SessionOpen  c 127.0.0.1 33829 :80
   12 ReqStart     c 127.0.0.1 33829 1171098618
   12 RxRequest    c GET
   12 RxURL        c /
   12 RxProtocol   c HTTP/1.1
   12 RxHeader     c Host: ganglia.gentoo
   12 RxHeader     c User-Agent: Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0
   12 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
   12 RxHeader     c Accept-Language: en-us
   12 RxHeader     c Accept-Encoding: gzip,deflate
   12 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
   12 RxHeader     c Connection: keep-alive
   12 VCL_call     c recv lookup
   12 VCL_call     c hash
   12 Hash         c /
   12 Hash         c ganglia.gentoo
   12 VCL_return   c hash
   12 HitPass      c 1171098616
   12 VCL_call     c pass pass
   12 Backend      c 13 apache apache
   12 TTL          c 1171098618 RFC 120 -1 -1 1317921851 0 1317921851 0 0
   12 VCL_call     c fetch
   12 TTL          c 1171098618 VCL 120 -1 -1 1317921851 -0
   12 VCL_return   c hit_for_pass
   12 ObjProtocol  c HTTP/1.1
   12 ObjResponse  c OK
   12 ObjHeader    c Date: Thu,06 Oct 2011 17:24:11 GMT
   12 ObjHeader    c Server: Apache
   12 ObjHeader    c Content-Length: 17
   12 ObjHeader    c Content-Type: text/html
   12 VCL_call     c deliver deliver
   12 TxProtocol   c HTTP/1.1
   12 TxStatus     c 200
   12 TxResponse   c OK
   12 TxHeader     c Server: Apache
   12 TxHeader     c Content-Type: text/html
   12 TxHeader     c Content-Length: 17
   12 TxHeader     c Accept-Ranges: bytes
   12 TxHeader     c Date: Thu,06 Oct 2011 17:24:11 GMT
   12 TxHeader     c X-Varnish: 1171098618
   12 TxHeader     c Age: 0
   12 TxHeader     c Via: 1.1 varnish
   12 TxHeader     c Connection: keep-alive
   12 Length       c 17
   12 ReqEnd       c 1171098618 1317921851.307137489 1317921851.344322681 0.000065327 0.037110329 0.000074852

正如@Oneiroi所提到的,根据man page

-b     Include log entries which result from communication with a backend server.  If neither -b  nor  -c
          is specified,varnishlog acts as if they both were.

   -c     Include log entries which result from communication with a client.  If neither -b nor -c is speci                        

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读