I am using tsung 1.7 and in my configuration I am sending a series of HTTP requests to a server which responds with a json of the format
Recv:1559218599.939782:<0.9056.0>:HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
content-length: 103
date: Thu, 30 May 2019 12:16:39 GMT
{"jsonrpc":"2.0","result":"0xc157d5234e32b0caba423b26278d724ba084ab20068d29cc02185e921f8b8035","id":1}
I need to log to an external file just the timestamp at the first line and the content of the json key "result".
I know with dynamic variables is possible to access information from the server response. Do you know if is possible to log such information on a file?
If you know erlang, you can write erlang function which writes the dynamic variables into the file and call the function in tsung.
When a substitution is requested, the substitution mark-up is replaced by the result of the call to the Erlang function: Module:Function({Pid, DynData}) where Pid is the Erlang process id of the current virtual user and DynData the list of all Dynamic variables (Warn: before version 1.1.0, the argument was just the Pid!).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.