Skip to content

Instantly share code, notes, and snippets.

@zhu327
Created August 14, 2018 02:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhu327/6bb6d56ed379b36534c6db4365dbb431 to your computer and use it in GitHub Desktop.
Save zhu327/6bb6d56ed379b36534c6db4365dbb431 to your computer and use it in GitHub Desktop.
logging response from wrk
wrk.path = "/rest/ping"
wrk.method = "POST"
wrk.body = "id=7579764573763278289&platformid=ANDROID&version=1.0.0"
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"
wrk.headers["deviceid"] = "354435052821931"
wrk.headers["Accept"] = "application/json"
logfile = io.open("wrk.log", "w");
local cnt = 0;
response = function(status, header, body)
logfile:write("status:" .. status .. "\n");
cnt = cnt + 1;
logfile:write("status:" .. status .. "\n" .. body .. "\n-------------------------------------------------\n");
end
done = function(summary, latency, requests)
logfile:write("------------- SUMMARY -------------\n")
print("Response count: ", cnt)
logfile.close();
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment