{"id":961,"date":"2012-03-12T02:33:13","date_gmt":"2012-03-11T17:33:13","guid":{"rendered":"http:\/\/blog.xcir.net\/?p=961"},"modified":"2012-03-13T01:11:32","modified_gmt":"2012-03-12T16:11:32","slug":"varnishlogtrans-version-upmapping-from-vcl_trace-to-vcl-source","status":"publish","type":"post","link":"http:\/\/blog.xcir.net\/?p=961","title":{"rendered":"varnishlogtrans version up(mapping from vcl_trace to vcl source)"},"content":{"rendered":"<p>varnishlogtrans version up(mapping from vcl_trace to vcl source)<\/p>\n<p><a href=\"http:\/\/blog.xcir.net\/index.php\/2012\/02\/convert-varnishlog-output-to-easy\/\" title=\"convert varnishlog output to easy\">Past Articles:convert varnishlog output to easy<\/a><\/p>\n<h4>Changes<\/h4>\n<li>Feature: mapping from vcl_trace to vcl source(line).(request from @perbu)<\/li>\n<li>Feature: show backend status.(request from @dai_yamashita)<\/li>\n<li>Change: Add run option.<\/li>\n<li>Experimental: mapping from vcl_trace to vcl source(all).<\/li>\n<h4>mapping from vcl_trace to vcl source(line).<\/h4>\n<p>if you set to -f option, replace vcl_trace to VCL code<br \/>\nbefore.<br \/>\n[code=&#8217;plain&#8217;]<br \/>\n         | trace  | vrt_count:1 vcl_line:55 vcl_pos:1<br \/>\n[\/code]<\/p>\n<p>after(use -f and -e option)<br \/>\n[code=&#8217;plain&#8217;]<br \/>\n         | trace  | set req.http.X-TEST1=campur_xcir.gethash();<br \/>\n         |        | ^ (vrt_count:1 vcl_line:55 vcl_pos:1 src_name:input)<\/p>\n<p>[\/code]<\/p>\n<h4>show backend status.<\/h4>\n<p>show backend status.<br \/>\npast status is window 4times.<\/p>\n<p>[code=&#8217;plain&#8217;]<br \/>\nbackend status<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>name    | status  | past status<br \/>\ndefault | healthy | YY<br \/>\n[\/code]<\/p>\n<h4>Add run option.<\/h4>\n<h5>-f [vcl file]<\/h5>\n<p>if you set, you can mapping  from vcl_trace to vcl source.<\/p>\n<h5>-e [varnishd]<\/h5>\n<p>if you set, you can mapping  from vcl_trace to vcl source.<\/p>\n<h5>-cc_command [cc_command]<\/h5>\n<p>if you set in the -f option and varnish&#8217;s cc_command option ,please setting.<\/p>\n<h5>&#8211;(backend|action|variable) [on|off]<\/h5>\n<p>if you want to disable (backend|action|variable) info , set to off. (default is on)<\/p>\n<h4>mapping from vcl_trace to vcl source(all).<\/h4>\n<p>this function is unstable.<br \/>\nif you want use this function.<br \/>\nit need change value and set option(&#8211;src=on -f=[vclfile] -e=[varnishd]).<\/p>\n<p>before<br \/>\n[code=&#8217;php&#8217;]<br \/>\ndefine(&#8216;experimental&#8217; , false);<br \/>\n[\/code]<\/p>\n<p>after<br \/>\n[code=&#8217;php&#8217;]<br \/>\ndefine(&#8216;experimental&#8217; , true);<br \/>\n[\/code]<\/p>\n<p>output<br \/>\n[code=&#8217;plain&#8217;]<br \/>\n############################################################<br \/>\nvcl trace<br \/>\n[exec]      \/* &#8220;input&#8221;*\/<br \/>\n[exec]  \/*<\/p>\n<p>&#8230;<\/p>\n<p>[exec]  sub vcl_recv {<br \/>\n[exec]      if (req.restarts == 0) {<br \/>\n[exec]          if (req.http.x-forwarded-for) {<br \/>\n                    set req.http.X-Forwarded-For =<br \/>\n                        req.http.X-Forwarded-For + &#8220;, &#8221; + client.ip;<br \/>\n[exec]          } else {<br \/>\n[exec]              set req.http.X-Forwarded-For = client.ip;<br \/>\n[exec]          }<br \/>\n[exec]      }<br \/>\n[exec]      if (req.request != &#8220;GET&#8221; &amp;amp;amp;&amp;amp;amp;<br \/>\n[exec]        req.request != &#8220;HEAD&#8221; &amp;amp;amp;&amp;amp;amp;<br \/>\n[exec]        req.request != &#8220;PUT&#8221; &amp;amp;amp;&amp;amp;amp;<br \/>\n[exec]        req.request != &#8220;POST&#8221; &amp;amp;amp;&amp;amp;amp;<\/p>\n<p>&#8230;<br \/>\n[\/code]<\/p>\n<p>I hope that this code is of help to you.<\/p>\n<p>download here.<br \/>\n<a href=\"https:\/\/github.com\/xcir\/varnishlogTrans\">varnishlogTrans<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>varnishlogtrans version up(mapping from vcl_trace to vcl source) Past Articles:convert varnishlog output to ea <a href='http:\/\/blog.xcir.net\/?p=961' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,3],"tags":[5,35,36],"class_list":["post-961","post","type-post","status-publish","format-standard","hentry","category-english","category-3","tag-varnish","tag-varnishlog","tag-varnishlogtrans","category-24-id","category-3-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=961"}],"version-history":[{"count":7,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/961\/revisions"}],"predecessor-version":[{"id":972,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/961\/revisions\/972"}],"wp:attachment":[{"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=961"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}