EN
less - browse gzipped logs
4
points
In this short article, we would like to show how to browse gzipped log files (*.gz
files) using less
command in Bash.
Quick solution (run the following command):
zless /path/to/log.gz
Where: zless
calls less
with *.gz
files reading support.
Practical example
Run command:
zless /var/logs/example/2021-05-29.log.gz
Example output:
...
2021-05-29 18:08:59.759 INFO 20993 --- [main] l.SpringBootWebApplication : Starting SpringBootWebApplication v1.0 using Java 1.8.0_292 on my-server with PID 20993 (/opt/example-spring-boot/target/example.war started by root in /opt/example-spring-boot/target)
2021-05-29 18:08:59.794 INFO 20993 --- [main] l.SpringBootWebApplication : No active profile set, falling back to default profiles: default
2021-05-29 18:09:02.994 INFO 20993 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-05-29 18:09:03.743 INFO 20993 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 731 ms. Found 30 JPA repository interfaces.
2021-05-29 18:09:05.503 INFO 20993 --- [main] o.s.b.w.e.t.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
...