Piping into moreutils' ts with nanosecond precision?
Starting from moreutils 0.31 %.S
specifier is available, use it instead of %S :
ping google.com | ts '%Y%m%d-%H:%M:%.S'
20160327-15:01:11.361885 PING google.com (216.58.209.206) 56(84) bytes of data.
20160327-15:01:11.362056 64 bytes from bud02s22-in-f206.1e100.net (216.58.209.206): icmp_seq=1 ttl=57 time=26.3 ms
20160327-15:01:12.314243 64 bytes from bud02s22-in-f206.1e100.net (216.58.209.206): icmp_seq=2 ttl=57 time=26.2 ms
20160327-15:01:13.315651 64 bytes from bud02s22-in-f206.1e100.net (216.58.209.206): icmp_seq=3 ttl=57 time=26.3 ms
As of v0.62 the '%T' specifier also comes in a high-resolution variety:
$ for i in {1..5}; do hostname; done | ts '[%F %.T]'
[2018-05-27 17:25:14.153490] quark
[2018-05-27 17:25:14.153753] quark
[2018-05-27 17:25:14.153779] quark
[2018-05-27 17:25:14.153798] quark
[2018-05-27 17:25:14.153816] quark