Skip to content

Instantly share code, notes, and snippets.

@kbence
Created May 27, 2021 14:35
Show Gist options
  • Save kbence/576d535865d0a7ee9fa400204ed80736 to your computer and use it in GitHub Desktop.
Save kbence/576d535865d0a7ee9fa400204ed80736 to your computer and use it in GitHub Desktop.
Jq script to convert HAR files to vegeta requests (GET only)
#!/usr/bin/env jq -r --from-file
.log.entries[].request
| select(.url | contains("example.com"))
| select(.method == "GET")
| .method + " " + .url + "\n" +
(
[
.headers[]
| select(.name | startswith(":") == false)
| select(.value != "")
| .name + ": " + .value
]
| join("\n")
) +
"\n"
@kbence
Copy link
Author

kbence commented May 27, 2021

Example usage (sending realistic traffic based on a HAR file):

har2vegeta.jq example.com.har | vegeta attack -duration 60s -rate 15 | vegeta report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment