log.dat: Fix an error with 'monit' logging too much data.

Message ID 20220121170756.3466085-1-matthias.fischer@ipfire.org
State Accepted
Commit 8f58e6612b63a0b3bcfabd36dc2e0dbf958e6d98
Headers
Series log.dat: Fix an error with 'monit' logging too much data. |

Commit Message

Matthias Fischer Jan. 21, 2022, 5:07 p.m. UTC
  Making the regex "non-greedy" fixes an error Jon found.

'monit' logged a whole line from '/var/log/messages' where it should only log the first part.

Reference:
https://www.ultraedit.com/support/tutorials-power-tips/ultraedit/non-greedy-perl-regex.html

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
---
 html/cgi-bin/logs.cgi/log.dat | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Peter Müller Jan. 25, 2022, 4:53 p.m. UTC | #1
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>

> Making the regex "non-greedy" fixes an error Jon found.
> 
> 'monit' logged a whole line from '/var/log/messages' where it should only log the first part.
> 
> Reference:
> https://www.ultraedit.com/support/tutorials-power-tips/ultraedit/non-greedy-perl-regex.html
> 
> Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
> ---
>  html/cgi-bin/logs.cgi/log.dat | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat
> index 0d6c6722a..3364b7bea 100644
> --- a/html/cgi-bin/logs.cgi/log.dat
> +++ b/html/cgi-bin/logs.cgi/log.dat
> @@ -62,7 +62,7 @@ my %sections = (
>          'ipfire' => '(ipfire: )',
>          'ipsec' => '(ipsec_[\w_]+: |pluto\[.*\]: |charon: |vpnwatch: )',
>          'kernel' => '(kernel: (?!DROP_))',
> -        'monit' => '(monit\[.*\]: )',
> +        'monit' => '(monit\[.*?\]: )',
>          'ntp' => '(ntpd(?:ate)?\[.*\]: )',
>  	'oinkmaster' => '(oinkmaster\[.*\]: )',
>          'openvpn' => '(openvpnserver\[.*\]: |.*n2n\[.*\]: )',
  
Bernhard Bitsch Jan. 28, 2022, 1:20 p.m. UTC | #2
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>

Am 21.01.2022 um 18:07 schrieb Matthias Fischer:
> Making the regex "non-greedy" fixes an error Jon found.
> 
> 'monit' logged a whole line from '/var/log/messages' where it should only log the first part.
> 
> Reference:
> https://www.ultraedit.com/support/tutorials-power-tips/ultraedit/non-greedy-perl-regex.html
> 
> Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
> ---
>   html/cgi-bin/logs.cgi/log.dat | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat
> index 0d6c6722a..3364b7bea 100644
> --- a/html/cgi-bin/logs.cgi/log.dat
> +++ b/html/cgi-bin/logs.cgi/log.dat
> @@ -62,7 +62,7 @@ my %sections = (
>           'ipfire' => '(ipfire: )',
>           'ipsec' => '(ipsec_[\w_]+: |pluto\[.*\]: |charon: |vpnwatch: )',
>           'kernel' => '(kernel: (?!DROP_))',
> -        'monit' => '(monit\[.*\]: )',
> +        'monit' => '(monit\[.*?\]: )',
>           'ntp' => '(ntpd(?:ate)?\[.*\]: )',
>   	'oinkmaster' => '(oinkmaster\[.*\]: )',
>           'openvpn' => '(openvpnserver\[.*\]: |.*n2n\[.*\]: )',
  

Patch

diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat
index 0d6c6722a..3364b7bea 100644
--- a/html/cgi-bin/logs.cgi/log.dat
+++ b/html/cgi-bin/logs.cgi/log.dat
@@ -62,7 +62,7 @@  my %sections = (
         'ipfire' => '(ipfire: )',
         'ipsec' => '(ipsec_[\w_]+: |pluto\[.*\]: |charon: |vpnwatch: )',
         'kernel' => '(kernel: (?!DROP_))',
-        'monit' => '(monit\[.*\]: )',
+        'monit' => '(monit\[.*?\]: )',
         'ntp' => '(ntpd(?:ate)?\[.*\]: )',
 	'oinkmaster' => '(oinkmaster\[.*\]: )',
         'openvpn' => '(openvpnserver\[.*\]: |.*n2n\[.*\]: )',