Log PING to a Text File

When network equipment is experiencing dropouts, you often need to run a constant ping to track when equipment or a connection may be failing.

There are several ways to do this, you could just run a ping command straight from Windows. Although, this approach does work and yes you can log pings in indefinitely with the “-t” switch – It does not timestamp your results.

Which makes it difficult in analyzing your results over a number of hours.

Windows Command Line – Ping with the ‘-t’ switch

Ping with Timestamp on Windows

So, what are the solutions, well on Windows my preferred tool is HrPing – High-precision ping utility.

To get started with HrPing follow the below guide:

  • Download HrPing from this link and once downloaded extract it to a folder.
  • Open Command Prompt (Windows + R) then type CMD and click Ok.
  • Once in command prompt navigate to the folder with your hrping.exe file.
  • Then simply run a command like the below which logs a timestamp at the beginning of each line and sets a log file to look back on your results.

“hrping.exe google.com -t -T -F logfile-Google.txt”

Ping with Timestamp on Linux

Logging with Linux is simple, simply terminal into your Linux device or open up console if you’re already on a Linux machine.

The run the following command – Note there is no Verbrose output – But, you can open the text file the log is going into at any point until you cancel the command.

“sudo ping | while read pong; do echo “$(date): $pong”; done > Ping-9pm.txt”

Note – I used sudo in my ping command as it’s pretty well the only way to execute commands on a Synology.