ご希望通りかどうか分かりませんが、ts
コマンドがインストールされていれば、
コマンド | ts
で、コマンド出力の各行頭にタイムスタンプ(形式はオプションで指定可能)を追加できます。
ちょっといまdocker
コマンドを使える環境に無いですが、ping
だとこんな感じです。
sh
1$ ping -c 3 localhost
2PING localhost(localhost (::1)) 56 data bytes
364 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.047 ms
464 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.127 ms
564 bytes from localhost (::1): icmp_seq=3 ttl=64 time=0.101 ms
6
7--- localhost ping statistics ---
83 packets transmitted, 3 received, 0% packet loss, time 2044ms
9rtt min/avg/max/mdev = 0.047/0.091/0.127/0.035 ms
10$ ping -c 3 localhost | ts
11Mar 05 02:32:24 PING localhost(localhost (::1)) 56 data bytes
12Mar 05 02:32:24 64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.043 ms
13Mar 05 02:32:25 64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.061 ms
14Mar 05 02:32:26 64 bytes from localhost (::1): icmp_seq=3 ttl=64 time=0.112 ms
15Mar 05 02:32:26
16Mar 05 02:32:26 --- localhost ping statistics ---
17Mar 05 02:32:26 3 packets transmitted, 3 received, 0% packet loss, time 2049ms
18Mar 05 02:32:26 rtt min/avg/max/mdev = 0.043/0.072/0.112/0.029 ms
あるいは、1回ずつ表示することにして、
sh
1while sleep 1
2do date
3 docker stats --no-stream
4done
とか。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2025/03/08 05:32