Languages
[Edit]
EN

less - browse gzipped logs

4 points
Created by:
Faith-W
413

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

 

Practical example

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)

...

 

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join