我有一个带有cookie的access.log nginx:
99.20.231.22 www.carite.com - [01/Dec/2015:03:00:10 -0600] "GET /?mode=_ajax&_imod[]=i159330&make=Mercedes-Benz&_=1448960297171 HTTP/1.1" 200 1182 "http://www.carite.com/" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1" "PHPSESSID=ebg5n89m9pc1iamekii1qra5k0; chooseStoreNotificationShown=1; dfa_visit=1448960180633603603; dfa_visitor=1448960180633796491; mod-compare-box=%7B%22vehicles%22%3A%7B%22v11279294%22%3A%7B%22vuid%22%3A%2211279294%22%2C%22isCompared%22%3Afalse%7D%7D%2C%22compareAll%22%3Atrue%2C%22cookieLifeTime%22%3A30%2C%22cookiePath%22%3A%22%5C%2F%22%7D; _ga=GA1.2.10339867.1448960182; _gali=make; _gat_a1=1; _gat_a2=1; _gat_a3=1; _gat_a4=1; usy46gabsosd=collserve__-2_1448960382693_8786" 80 0.295
我可以从访问日志中指定Yandex-tank get cookie并将其添加到每个yandex-tank请求中吗?
此外,我需要获得标题"主持人:"从访问日志而不是在load.ini
中指定它:
headers = [Host: www.carite.com]
答案 0 :(得分:0)
您有两种选择:
使步进器从access.log中读取cookie和uri(它 应该在那里做 https://github.com/yandex/yandex-tank/blob/master/yandextank/stepper/missile.py#L213)
以https://yandextank.readthedocs.org/en/latest/tutorial.html#uri-style-uris-in-file格式从access.log创建单独的文件。随时随地覆盖标题,因此您可以在任何地方重新定义标题
例如它可能是这样的:
[主持人:www.carite.com]
[Cookie:PHPSESSID = ebg5n89m9pc1iamekii1qra5k0; chooseStoreNotificationShown = 1; dfa_visit = 1448960180633603603; dfa_visitor = 1448960180633796491; ...]
/模式= _ajax&安培; IMOD [] = i159330&安培;使=奔驰&安培; = 1448960297171
...
[主持人:example.com]
[Cookie:myowncookie = 1]
/东西
......
我建议使用第二种方式作为最简单的方法