1

I have a similar case to: Generating usage logs that prove my Internet connection is flaky

However these logs will get long quickly. I am only interested in logging timeouts, is there a way to achieve this? I was hoping -q might but it doesn't seem to.

I am doing this on macOS, so I'm looking for a solution that works with macOS's BSD-derived ping(8) (https://ss64.com/mac/ping.html)

I would like to search the strings after they are processed (in this case prefixed) so I can have more flexibility:

ping comcast.net | while read pong; do echo "$(date): $pong"; done

I know ping comcast.net grep timeout will almost work, but I can't figure out how to combine grep into my existing script

SS64
  • 111
Mr. Boy
  • 5,554

1 Answers1

0

I came up with this:

ping comcast.net | while read pong ; do if [[ $pong != *time=* ]] ; then echo "$(date): $pong" ; fi ; done

but I suppose technically if you only want to log with the word timeout:

ping comcast.net | while read pong ; do if [[ $pong == *timeout* ]] ; then echo "$(date): $pong" ; fi ; done
Keith
  • 131