Let's assume your base file is called "my-app". Then it's time to use magic open! Untested:
This will read uncompressed files in the usual way, and read from a pipe (with zcat on the other end) for compressed files.my @files = </var/log/my-app*>; /\.gz/ and $_ = "zcat $_ |" for @files; local @ARGV = @files; while (<>) { ... do something with record ... }
In reply to Re: How to read from rotated log file?
by JavaFan
in thread How to read from rotated log file?
by Wen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |