Save download statistics / log

I am reading a stream with curl and grep with some highlights. curl url | grep wish_key_word

I noticed that curl provides me with good download statistics, for example:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10.9M    0 10.9M    0     0  1008k      0 --:--:--  0:00:11 --:--:-- 1092k

How to save statistics, for example. every second in a file?

I found this: http://curl.haxx.se/mail/archive-2002-11/0115.html , however it could not distract him from my problem.

curl -n agent.mtconnect.org/sample\?interval=0 -o xml_stream.log 2>> dl.log

dl.log should include statistics, but it doesn’t work.

+4
source share
2 answers

Here is a non-abstract version.

curl -s -S -n http://speedtest.fremont.linode.com/100MB-fremont.bin -o /dev/null -w "%{time_total},%{size_download},%{speed_download}\n" >> stats.log

+1
source

Only stdout gets redirected with the -o flag.

For the -o flag, the manual page says:

-o/--output <file>
          Write output to <file> instead of stdout...

stderr, - :

curl -n agent.mtconnect.org/sample\?interval=0 >> xml_stream.log 2>> dl.log
0

Source: https://habr.com/ru/post/1532222/


All Articles