mirror of
https://github.com/webmin/webmin.git
synced 2026-02-08 16:29:58 +00:00
Fix log filtering logic to work with new regex flag correctly
This commit is contained in:
@@ -180,13 +180,8 @@ if (!$follow) {
|
||||
my $fcmd;
|
||||
my $context_opts = $has_context ? " -C $context_lines" : "";
|
||||
if ($cmd =~ /journalctl/) {
|
||||
if ($use_regex && !$has_context) {
|
||||
$fcmd = "$cmd --grep $filter";
|
||||
}
|
||||
else {
|
||||
$fcmd = "$cmd | grep -a $grep_mode$context_opts ".
|
||||
"$dashflag $filter";
|
||||
}
|
||||
$fcmd = "$cmd | grep -a $grep_mode$context_opts ".
|
||||
"$dashflag $filter";
|
||||
}
|
||||
else {
|
||||
$fcmd = "$cat | grep -i -a $grep_mode$context_opts ".
|
||||
|
||||
@@ -39,12 +39,8 @@ my $filter = $in{'filter'} ? quotemeta($in{'filter'}) : "";
|
||||
my $use_regex = $in{'regex'} ? 1 : 0;
|
||||
my $readcmd = $log->{'cmd'};
|
||||
if ($filter) {
|
||||
if ($use_regex) {
|
||||
$readcmd .= " --grep $filter";
|
||||
}
|
||||
else {
|
||||
$readcmd .= " | grep --line-buffered -F -a -- $filter";
|
||||
}
|
||||
my $grep_flag = $use_regex ? "-E" : "-F";
|
||||
$readcmd .= " | grep --line-buffered -a $grep_flag -- $filter";
|
||||
}
|
||||
|
||||
# Open a pipe to the journalctl command
|
||||
|
||||
Reference in New Issue
Block a user