Languages
[Edit]
EN

less - browse gzipped logs

4 points
Created by:
Faith-W
503

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)

...

 

See also

  1. grep - search text in gzipped file

Alternative titles

  1. less - browse *.gz log files
  2. less - browse gzip logs
  3. less - browse gzip log files
  4. zless - usage simple example
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
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