> ## Content Index
> Fetch the complete content index at: https://www.bagz.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Display log file with timestamp in human-readable format
- URL: https://www.bagz.fr/display-log-file-with-timestamp-in-human-readable-format/
- Published: 2023-12-12T16:30:44.000Z
- Updated: 2023-12-12T16:30:44.000Z
- Author: bgazui
- Tags: Linux, MacOS, #Migrated-1790668826633, #wp, #wp-post, #Import 2026-09-29 08:00

By default, some logs (like squid logs) will be recorded with unix timestamp, stored as *<unixtimestamp>.<centisecond>* which are hard to read for analysis.

You would have for example this kind of logs:

```
1702397611.273  14010 192.168.1.2 TCP_MISS_ABORTED/000 0 GET http://xx.yyy.zz/ - HIER_DIRECT/0.0.0.0 -
1702397866.155   1092 192.168.1.2 TCP_TUNNEL_ABORTED/200 5478 CONNECT xx.yyy.zz:443 - HIER_DIRECT/0.0.0.0 -
1702397866.161   1349 192.168.1.2 TCP_TUNNEL_ABORTED/200 4589 CONNECT xx.yyy.zz:443 - HIER_DIRECT/0.0.0.0 -
1702398066.598  34006 192.168.1.2 TCP_TUNNEL/200 7336 CONNECT xx.yyy.zz:443 - HIER_DIRECT/0.0.0.0 -
1702398133.589  63009 192.168.1.2 TCP_TUNNEL/200 4989 CONNECT xx.yyy.zz:443 - HIER_DIRECT/0.0.0.0 -
```

In order to display them in human readable format, you can just use that simple command:

```
cat access.log | perl -p -e 's/^([0-9\.]*)/"[".localtime($1)."]"/e'
```

You will then have such result:

```
[Tue Dec 12 17:13:31 2023]  14010 192.168.1.2 TCP_MISS_ABORTED/000 0 GET http://xx.yyy.zz/ - HIER_DIRECT/0.0.0.0 -
[Tue Dec 12 17:17:46 2023]   1092 192.168.1.2 TCP_TUNNEL_ABORTED/200 5478 CONNECT xx.yyy.zz:443 - HIER_DIRECT/0.0.0.0 -
[Tue Dec 12 17:17:46 2023]   1349 192.168.1.2 TCP_TUNNEL_ABORTED/200 4589 CONNECT xx.yyy.zz:443 - HIER_DIRECT/0.0.0.0 -
[Tue Dec 12 17:21:06 2023]  34006 192.168.1.2 TCP_TUNNEL/200 7336 CONNECT xx.yyy.zz:443 - HIER_DIRECT/0.0.0.0 -
[Tue Dec 12 17:22:13 2023]  63009 192.168.1.2 TCP_TUNNEL/200 4989 CONNECT xx.yyy.zz:443 - HIER_DIRECT/0.0.0.0 -
```