Fixed multifile search

This commit is contained in:
ismael.moreno 2020-01-27 12:01:52 +01:00
parent 28392b71ef
commit 5017c56454
1 changed files with 12 additions and 6 deletions

View File

@ -258,7 +258,7 @@ sub parse_config {
$plugin_setup{"log"}->[$log_items]->{"type"} = $1; $plugin_setup{"log"}->[$log_items]->{"type"} = $1;
} }
if ($parametro =~ m/^log\_create_module_for_each_log/i) { if ($parametro =~ m/^log\_create\_module\_for\_each\_log/i) {
$plugin_setup{"log"}->[$log_items]->{"module_for_each_log"} = 1; $plugin_setup{"log"}->[$log_items]->{"module_for_each_log"} = 1;
} else { } else {
if (!defined($plugin_setup{"log"}->[$log_items]->{"module_for_each_log"})){ if (!defined($plugin_setup{"log"}->[$log_items]->{"module_for_each_log"})){
@ -482,7 +482,6 @@ sub parse_log ($$$$$$$) {
while ($line = <LOGFILE>) { while ($line = <LOGFILE>) {
while (my ($key, $value) = each (%{$regexp_collection})) { while (my ($key, $value) = each (%{$regexp_collection})) {
# For each regexp block # For each regexp block
$rule = $value->{"rule"}; $rule = $value->{"rule"};
#print "[DEBUG] Action: ".$value->{"action"} ."\n"; #print "[DEBUG] Action: ".$value->{"action"} ."\n";
@ -491,7 +490,6 @@ sub parse_log ($$$$$$$) {
#print "[DEBUG] Rule: ".$value->{"rule"} ."\n"; #print "[DEBUG] Rule: ".$value->{"rule"} ."\n";
if ($line =~ m/$rule/i) { if ($line =~ m/$rule/i) {
# Remove the trailing '\n' # Remove the trailing '\n'
chop($line); chop($line);
@ -613,9 +611,17 @@ sub manage_logfile ($$$$$){
$index_file_converted =~ s/\\/_/g; $index_file_converted =~ s/\\/_/g;
$index_file_converted =~ s/\|/_/g; $index_file_converted =~ s/\|/_/g;
$index_file_converted =~ s/\:/_/g; $index_file_converted =~ s/\:/_/g;
$module_name =~ s/\//_/g;
$module_name =~ s/\\/_/g;
$module_name =~ s/\|/_/g;
$module_name =~ s/\:/_/g;
# Create index file if it does not exist # Create index file if it does not exist
$Idx_file = $plugin_setup{"index_dir"} . "/". $module_name . "_" . $index_file_converted . ".idx"; if($^O =~ /win/i){
$Idx_file = $plugin_setup{"index_dir"} . "\\". $module_name . "_" . $index_file_converted . "\.idx";
}else{
$Idx_file = $plugin_setup{"index_dir"} . "/". $module_name . "_" . $index_file_converted . "\.idx";
}
# if force read all is enabled, # if force read all is enabled,
if (! -e $Idx_file) { if (! -e $Idx_file) {
@ -716,7 +722,7 @@ while (my ($key, $value) = each (@{$plugin_setup{"log"}})) {
if (defined($value->{"log_location_multiple"})){ if (defined($value->{"log_location_multiple"})){
$log_filename_multiple = $value->{"log_location_multiple"}; $log_filename_multiple = $value->{"log_location_multiple"};
$log_create_module_for_each_log = $value->{"module_for_each_log"}; $log_create_module_for_each_log = $value->{"module_for_each_log"};
my @buffer = `find $log_filename_multiple`; my @buffer = `ls -d "$log_filename_multiple"`;
foreach (@buffer) { foreach (@buffer) {
# This should solve problems with carriage return in Unix, Linux and Windooze # This should solve problems with carriage return in Unix, Linux and Windooze
chomp($_); chomp($_);