System Logs Questions

I apologize if this was in the documentation and I missed it. I have two questions about logging in IPFire:

  • What is required of files to show up in the System Logs page in IPFire? Do all files in /var/log show up on that page?
  • Do I need to do anything to enable log rotation for log files in /var/log ?

Thanks,
Craig

Not everything but definitely the important ones!

Nothing needs to be done. Logs are auto rotated once per week.

1 Like

Thanks @jon . I should have been more specific. If I write to a new file in /var/log, will it show in the web interface?

Sorry, it will not.

Any idea what would be required to make it show up?

The Developers would need to answer. I am not sure…

Are you creating an add-on?

1 Like

I’m planning to add some scripts. I don’t know that I want to create a full-fledged add-on.

You may want to try and dig thru the code. There are lots of examples already there. I think everything is in the log.cgi or log.dat files.

1 Like

Thanks @jon

this seems too easy but it looks like you’ll need to add two lines:

one line for the search criteria (a regex)
-and-
one line for the name in the menu

https://git.ipfire.org/?p=ipfire-2.x.git;a=blobdiff;f=html/cgi-bin/logs.cgi/log.dat;h=0d6c6722a6c749da035efa3cccd54f4a8227cf23;hp=e467e1d2efdb8b6d6b89a27a9272a273a1a6202e;hb=0b2aa5173d60878533ac72403d15ef9f97f8810f;hpb=e8c75ca765fad986d1898df039a49d1db584b45a

3 Likes

Hi Jon, hi Craig,

yes, if the application in question logs to /var/log/messages, adding a regular expression for a pattern present in every message it emits should be sufficient.

To add a more general comment on logging: Currently, most applications and daemons on IPFire log to /var/log/messages, which makes this file a bit bloated. You might have noticed if you are trying to troubleshoot something, conduct a tail -f on this file and need to grep out any log messages from programs you are not interested in. Example (removes log messages from IPsec):

tail -f /var/log/messages | grep -v "charon"

Some things, such as Suricata (IPS) and Squid, log into their own logfiles. I don’t know about other developers’ opinions, but to me, trying to split up log destinations makes sense.

To keep it short: Please consider logging into a custom logfile, if possible. :slight_smile:

Thanks, and best regards,
Peter Müller

4 Likes

Thanks. I’m definitely logging to a separate file. I’m building out some scripts to integrate UPSPACK_V3/README_en.md at master · rcdrones/UPSPACK_V3 · GitHub with my setup. Looking at the reference from @jon , I’m not seeing how I would add a separate file versus lines within the /var/log/messages file. I will so some more digging, but would love any pointers.

Craig

I guess my other question relates to how to make these types of changes such that they survive updates and also don’t break updates.

Thanks again,
Craig

Hi Craig,

The section starting on line 211 in log.dat is where the appropriate filename is defined depending on the $section that was defined as shown in the link from Jon.
The default is the var/log/messages but if the $section variable is dma then the logs are taken from /var/log/mail
You would need to add your $section name and file location for your log info into this if/else section.

Bear in mind that as with any editing of IPFire files that they might be reset during an IPFIre Core Update and you would have to redo your changes.

2 Likes

Is it possible to add to the menus similar to this? git.ipfire.org Git - ipfire-2.x.git/blob - config/menu/EX-tor.menu If so, what triggers these menu items to display? I’m not seeing them in my setup.

Thanks again,
Craig

I am guessing here but it may be part of this:

EDIT: I cannot find any recent changes to sidemenu_ex so it may have been forgotten about.

1 Like