I am on a ubuntu machine trying to read from log files and found the logs contain date and time in epoch format(seconds). How can I convert these dates in numbers into any readable format from command line?
1411622206, HOST ALERT, host-001,DOWN,SOFT,1,CHECK_NRPE, Socket timeout after 10 seconds.
1411622586, HOST ALERT, host-001,DOWN,SOFT,1,CHECK_NRPE, Socket timeout after 10 seconds.
1411623976, HOST ALERT, host-021,DOWN,SOFT,1,CHECK_NRPE, Socket timeout after 10 seconds.
1411624986, HOST ALERT, host-055,DOWN,SOFT,1,CHECK_NRPE, Socket timeout after 10 seconds.
1411625076, HOST ALERT, host-023,DOWN,SOFT,1,CHECK_NRPE, Socket timeout after 10 seconds.
1411625356, HOST ALERT, host-032,DOWN,SOFT,1,CHECK_NRPE, Socket timeout after 10 seconds.
1411625736, HOST ALERT, host-044,DOWN,SOFT,1,CHECK_NRPE, Socket timeout after 10 seconds.
Best Answer
What about using
date -d@SECONDS_SINCE_1970 [some format]
?Then you can play with the date options, so that you can get for example:
Test