Skip to content

Instantly share code, notes, and snippets.

@R4wm
Last active August 15, 2019 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save R4wm/01afd51f17f812bdec7ce8d76308d79e to your computer and use it in GitHub Desktop.
Save R4wm/01afd51f17f812bdec7ce8d76308d79e to your computer and use it in GitHub Desktop.
source the file then curlf for time formatted results
#!/bin/bash
echo '
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n' > /tmp/format.txt
alias curlf='curl -w "@/tmp/format.txt" -o /dev/null -s '
###########
# Example #
###########
# [Thu Aug 15 17:09:48] root@someserver001.xlx.lc4:~#
# [Thu Aug 15 17:09:48] root@someserver001.xlx.lc4:~# source curlf.sh
# [Thu Aug 15 17:10:40] root@someserver001.xlx.lc4:~# curlf -H"COntent-type: application/json" http://localhost:9200/soc-2019.08.15/_search -d @/tmp/soc-nop.json
# time_namelookup: 0.004
# time_connect: 0.004
# time_appconnect: 0.000
# time_pretransfer: 0.004
# time_redirect: 0.000
# time_starttransfer: 0.008
# ----------
# time_total: 10.070
# [Thu Aug 15 17:11:18] root@someserver001.xlx..lc4:~#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment