Bug 12921

Summary: System Logs does not offer a dedicated section for nut
Product: IPFire Reporter: Michael <ip.fire>
Component: ---Assignee: Adolf Belka <adolf.belka>
Status: CLOSED FIXED QA Contact:
Severity: Minor Usability    
Priority: - Unknown - CC: adolf.belka, bbitsch, cab_77573, michael.tremer, peter.mueller
Version: 2   
Hardware: unspecified   
OS: Unspecified   
See Also: https://bugzilla.ipfire.org/show_bug.cgi?id=12922
Attachments: syslog output for some nut logs

Description Michael 2022-08-31 13:59:20 UTC
Hi!

Right now and as of core 167, the System Logs do not offer a filter or better a section for selection, for NUT messages.

Maybe worth having a look and add an appropriate entry for filtering?

Thanks,
Michael
Comment 1 Adolf Belka 2022-09-17 12:58:42 UTC
Hi @Michael (bug reporter)

Can you provide an attachment which has a copy of the lines from /var/log/messages that relate to NUT.

I installed NUT on my vm testbed and configured it but because I don't have a UPS attached to my vm system, it failed to start and there was nothing in the logs labelled as coming from NUT except for an entry which was labelled as coming from upsd.
Comment 2 Michael 2022-09-17 14:15:04 UTC
Would it be OK, if I give you those lines in plain text format, below:

# cat /var/log/messages | grep upsmon
Sep 17 16:12:36 ipfire upsmon[7495]: Signal 15: exiting
Sep 17 16:12:36 ipfire upsmon[7494]: upsmon parent: read
Sep 17 16:12:46 ipfire upsmon[16984]: Startup successful

I just stopped NUT and restarted which put those lines into messages
Comment 3 Michael 2022-09-17 14:27:19 UTC
Created attachment 1089 [details]
syslog output for some nut logs

Just modified log.dat myself to show the output of those three line, pls. see attachment.
Comment 4 Adolf Belka 2022-09-18 10:56:27 UTC
(In reply to Michael from comment #3)
> Created attachment 1089 [details]
> syslog output for some nut logs
> 
> Just modified log.dat myself to show the output of those three line, pls.
> see attachment.

Hi @ Michael,
Can you give me the changes you made in log.dat so I don't re-invent the wheel.
Comment 5 Michael 2022-09-18 17:20:33 UTC
(In reply to Adolf Belka from comment #4)
> Hi @ Michael,
> Can you give me the changes you made in log.dat so I don't re-invent the
> wheel.

Sure! 

Inserted line 'nut', in no special order, pls. adjust as you like.
...
my %sections = (
...
        'unbound' => '(unbound: \[.*:.*\])(.*:.*$)',
        'nut' => '(upsmon\[.*?\]: )',

And translations, inserted line 'nut':
...
my %trsections = (
...
        'unbound' => 'DNS: Unbound',
        'nut' => 'Nut',

That's all! The labels can be modified as you like
Comment 6 Adolf Belka 2022-09-19 11:36:53 UTC
Hi @Michael,

Thanks. For the patch can I use your name and email address from this bug for the Tested-by: and Suggested-by: git tags?
Comment 7 Michael 2022-09-19 12:21:37 UTC
Yes, no problem!

Thanks!
Comment 8 Adolf Belka 2022-09-19 13:17:32 UTC
Patch fix has been submitted into the dev mailing liust and patchwork.

https://patchwork.ipfire.org/project/ipfire/patch/20220919131518.2779-1-adolf.belka@ipfire.org/
Comment 9 Adolf Belka 2022-09-24 12:23:45 UTC
Patch committed into next repository for Core Update 171

https://git.ipfire.org/?p=ipfire-2.x.git;a=commit;h=a15c20fde98a4ab34242dd3cefd9bbb890394188
Comment 11 Adolf Belka 2022-10-06 12:14:33 UTC
I have tested this on Core Update 171 Testing on my vm testbed and can confirm that NUT is available in the dropdown box for the System Logs now.

As I am not using a UPS system with my virtual testbed I can't properly test this out.

Hopefully @Michael can test this out and give the feedback.
Comment 12 Charles Brown 2022-10-07 13:53:28 UTC
On a related note, there is also no System Log selection for the apcupsd add-on.
-cab
Comment 13 Charles Brown 2022-10-07 14:05:29 UTC
I don't know if this bug fix has anything to do with it but something has gone wrong with System Logs in CU171. See Community Post ...
https://community.ipfire.org/t/ipfire-171-test-problems-logs-in-cgi-bin-logs-cgi-log-dat/8729/3
Comment 14 Adolf Belka 2022-10-07 14:14:33 UTC
(In reply to Charles Brown from comment #12)
> On a related note, there is also no System Log selection for the apcupsd
> add-on.
> -cab

Please raise this as a separate bug.
Comment 15 Adolf Belka 2022-10-07 14:16:22 UTC
(In reply to Charles Brown from comment #13)
> I don't know if this bug fix has anything to do with it but something has
> gone wrong with System Logs in CU171. See Community Post ...
> https://community.ipfire.org/t/ipfire-171-test-problems-logs-in-cgi-bin-logs-
> cgi-log-dat/8729/3

I already looked at this. This only added in NUT as a menu item on the log.dat page, which then filters what is already in the messages log.
Comment 16 Charles Brown 2022-10-07 15:12:19 UTC
(In reply to Adolf Belka from comment #14)
> (In reply to Charles Brown from comment #12)
> > On a related note, there is also no System Log selection for the apcupsd
> > add-on.
> > -cab
> 
> Please raise this as a separate bug.

https://bugzilla.ipfire.org/show_bug.cgi?id=12950