Log ping to host with timestamp.
@echo off
set /p host=HOST ADDRESS:
set logfile=Log_%host%.log
echo Target Host = %host% >%logfile%
for /f "tokens=*" %%A in ('ping %host% -n 1 ') do (echo %%A>>%logfile% && GOTO Ping)
:Ping
for /f "tokens=* skip=2" %%A in ('ping %host% -n 1 ') do (
echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A>>%logfile%
echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A
timeout 1 >NUL
GOTO Ping)
Ping some host with date every minute:
screen -dmS ping_from_edge1_to_edge2_eth0 bash -c 'while true; do date +"%Y-%m-%d %T" ; ping -c 60 IP_ADDRESS; done >> /home/user/ping_edge1_to_edge2_eth0.log'