Ping command with date time for log analysis in Windows or Linux
by Mountain Computers Inc, Publication Date: Saturday, February 24, 2024
View Count: 392, Keywords: Ping, Date Time, Log Analysis, Hashtags: #Ping #DateTime #LogAnalysis
For the longest time, the ping command has been one of my quick favorites to test network connectivity. There are other commands like nslookup, tracert aka traceroute, dig, host, etc... yet ping reigns the most helpful.
What was always elusive was the date time in the analysis for bash or batch command scripting. I even thought about downloading the open source ping .CPP source code and recompiling it as a useful utility, much like robocopy was once a resource kit only distribution, and now robocopy is included in a Windows OS by default.
Today, I googled for anyone else with the same kind of need and voila!
If you are running Linux or WSL use the following:
ping 10.0.0.1 | while read line; do echo `date` - $line; done
Works like a charm.
The MS-DOS Power Shell equivalent is more controversial and should be simple. Yet it is not.
more to come...
if you found this article helpful, consider contributing $10, 20 an Andrew Jackson or so..to the author. more authors coming soon
FYI we use paypal or patreon, patreon has 3x the transaction fees, so we don't, not yet.
© 2025 myBlog™ v1.1 All rights reserved. We count views as reads, so let's not over think it.