From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH 2/2] log.dat: Fixes Bug#12922 - adjusts regex to catch hostname for hostname or FQDN Date: Wed, 08 Mar 2023 15:59:55 +0100 Message-ID: <20230308145955.3567-2-adolf.belka@ipfire.org> In-Reply-To: <20230308145955.3567-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0946694234415862263==" List-Id: --===============0946694234415862263== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable - Most of the packages being searched for in the system logs section only put= hostname into the logs. However HAProxy puts the FQDN. Reviewing RFC 5424 shows that thi= s is following the requirements. The preferred order fromn the RFC is 1. FQDN 2. Static IP address 3. hostname 4. Dynamic IP address 5. the NILVALUE - Most of the programs are using option 3 but option 1 is valid for HAProxy - The regex change filters out the hostname from the FQDN if an extra 'dot' i= s present Fixes: Bug#12922 Suggested-by: Michael Tested-by: Michael Signed-off-by: Adolf Belka --- html/cgi-bin/logs.cgi/log.dat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat index d3f2599f8..53b9073fc 100644 --- a/html/cgi-bin/logs.cgi/log.dat +++ b/html/cgi-bin/logs.cgi/log.dat @@ -231,7 +231,7 @@ while ($gzindex >=3D0 && $loop) { #&General::log("reading $filestr"); READ:while () { my $line =3D $_; - if ($line =3D~ /^${monthstr} ${daystr} ..:..:.. [\w\-]+ ${section}(.*)/) { + if ($line =3D~ /^${monthstr} ${daystr} ..:..:.. [\w\-\.]+ ${section}(.*)/= ) { # when standard viewing, just keep in memory the correct slice # it starts a '$start' and size is $viewport # If export, then keep all lines... @@ -276,7 +276,7 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}) =20 foreach $_ (@log) { - /^... (..) (..:..:..) [\w\-]+ ${section}(.*)$/; + /^... (..) (..:..:..) [\w\-\.]+ ${section}(.*)$/; my $day =3D $1; $day =3D~ tr / /0/; my $time =3D $cgiparams{'DAY'} ? "$2" : "$day/$2" ; @@ -399,7 +399,7 @@ $lines =3D 0; #print ''; foreach $_ (@log) { - /^... (..) (..:..:..) [\w\-]+ ${section}(.*)$/; + /^... (..) (..:..:..) [\w\-\.]+ ${section}(.*)$/; my $day =3D $1; $day =3D~ tr / /0/; my $time =3D $cgiparams{'DAY'} ? "$2" : "$day/$2" ; --=20 2.39.2 --===============0946694234415862263==--