NAME

LogFilter - Filter logs based on keywords and exclusion patterns

VERSION

Version 0.10

SYNOPSIS

use LogFilter;

my $filter = LogFilter->new($keywords_file, $exclude_file, $log_file, $interval);

$filter->filter;

DESCRIPTION

LogFilter is a module for filtering log files based on keywords and exclusion patterns. It reads the log file line by line and if a line matches any keyword but does not match any exclusion pattern, it is printed to the console.

METHODS

new

my $filter = LogFilter->new($keywords_file, $exclude_file, $log_file, $interval);

Creates a new LogFilter object. Takes four arguments:

  • A file containing keywords, one per line

  • A file containing exclusion patterns, one per line

  • The log file to be filtered

  • The interval (in seconds) at which the log file should be read. Default is 1 if not specified.

filter

$filter->filter;

Starts the filtering process. Reads the log file at the specified interval and prints lines that match any keyword and do not match any exclusion pattern.

AUTHOR

Kawamura Shingo, pannakoota@gmail.com

LICENSE AND COPYRIGHT

Copyright 2023 Kawamura Shingo.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.