Java OpenResty Spring Spring Boot MySQL Redis MongoDB PostgreSQL Linux Android Nginx 面试 小程序 Arthas JVM AQS juc Kubernetes Docker 诊断工具


Linux 使用 dd 查看日志增长速度、方法每秒执行次数

Linux 大约 593 字

查看日志增长速度

of:输出到/dev/null黑洞中。

status=progress:显示速度。

tail -f test.log | dd of=/dev/null status=progress

输出

root@local:~# tail -f test.log | dd of=/dev/null status=progress
0 bytes copied, 21 s, 0.0 kB/s

查看方法每秒执行次数

tail -f test.log | grep --line-buffered "/api/user/info" | stdbuf -oL tr -dc '\n' | dd of=/dev/null bs=1 status=progress

测试命令,每隔一秒钟写入日志文件

while true; do echo "/api/user/info" >> test.log; sleep 1s; done

输出

root@local:~# tail -f test.log | grep --line-buffered "/api/user/info" | stdbuf -oL tr -dc '\n' | dd of=/dev
/null bs=1 status=progress
49 bytes copied, 252 s, 0.0 kB/s
阅读 1283 · 发布于 2022-06-21

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb

扫描下方二维码关注公众号和小程序↓↓↓

扫描二维码关注我
昵称:
随便看看 换一批