# Send filename and message to the parser,
# which will return if an action has to be performed.
- my @action = &Guardian::Parser::Parser("$parser", @message);
+ my $action = &Guardian::Parser::Parser("$parser", @message);
# Send the action to the main process and put it into
# the queue.
- if (@action) {
+ if (defined ($action)) {
# Lock the queue.
lock($queue);
# Put the required action into the queue.
- $queue->enqueue(@action);
+ $queue->enqueue($action);
}
} else {
# Sleep for 10ms until the next round of the loop will start.
# Update logger object in mainsettings hash.
$mainsettings{Logger} = $logger;
- # Update ignore list.
- &Guardian::Events::GenerateIgnoreList($mainsettings{IgnoreFile});
+ # Update ignore list, if one has been specified.
+ if (exists($mainsettings{IgnoreFile})) {
+ &Guardian::Events::GenerateIgnoreList($mainsettings{IgnoreFile});
+ }
# Re-generate hash of monitored files.
%monitored_files = &Guardian::Base::GenerateMonitoredFiles(\%mainsettings, \%monitored_files);
# Call responsible message parser.
my $action = $logfile_parsers{$parser}->(@message);
- # Return which action should be performed.
- return "count $action";
+ # In case an action has been returned, return it too.
+ if (defined($action)) {
+ # Return which action should be performed.
+ return "count $action";
+ }
+
+ # Return undef, no action required.
+ return undef;
}
#