cmkelley
Very Senior Member
scribe v3.0_0
2023-04-24
scribe is a script that installs syslog-ng and logrotate from Entware. Filters for various common logs are included, and logrotate files to manage those logs.
NOTE WELL:
Looking at log files to "see if anything is wrong" is counter-productive. Log files are best used to find the cause of a problem, or gain knowledge of how the system works. Just because a log entry "looks strange" or "unexplained", particularly if a new entry occurs after updating the firmware, does not at all mean that there is something wrong. Log entries occur for many reasons, including but not limited to:
Requirements
Asuswrt-Merlin version 380.68 or later running on a supported router with Entware installed. jffs scripts must be enabled, although Entware installation should have taken care of this.
IMPORTANT:
1: If you use Diversion, you must update Diversion to v4.1.0 or later for new installations.
2: If you intend to use Skynet, but have not installed it yet, it is preferred to install Skynet before installing scribe.
3: If you use Skynet, v6.9.2 or later is required.
4: It is not possible to update from scribe v1.0_0 (or earlier) without forcing a reinstall.
Installation
SSH into your router and run the following:
In addition to syslog-ng and logrotate, scribe also installs syslog-ng and logrotate configuration files to send syslog-ng's own logs, logrotate logs, WLCEVENTD logs, and (hopefully most) crash logs to their own separate files. All log files will be in /opt/var/log.
A single line is added to /opt/etc/init.d/S01syslog-ng that calls a helper script to kill the klogd and syslogd and make the necessary changes to the filesystem to keep syslogd from causing problems when GUI changes cause it to restart.
A single line is added to /jffs/scripts/service-event to call scribe and check for syslogd and klogd being restarted after either the "logger" or "time" services are (re-)started.
If Skynet is installed, a syslog-ng configuration file is also installed for it, and Skynet is automatically pointed at the new location for the iptables output. If you plan to install Skynet, it is highly preferable to install Skynet before scribe.
Options
A customized syslog-ng.conf file will be installed. This syslog-ng.conf file will remove sourcing a large number of functions from the /opt/share/syslog-ng/include/scl directory, change maximum log message size to 16K, and set stats frequency to every 6 hours. If installed, it copies the syslog-ng.conf file that came with the package to /opt/share/syslog-ng/examples.
Example Files
Of note, example files are placed in /opt/share/sylog-ng/examples/ and /opt/share/logrotate/examples/ for common programs (skynet, pixelserv-tls, etc). These can be copied directly to /opt/etc/syslog-ng.d/ and /opt/etc/logrotate.d/ for use. Do not blindly copy all of these files to their respective ".d" directories however, as doing so will prevent syslog-ng from running. Editing files directly here is not recommended as they will likely be overwritten if you choose to update the filters.
IMPORTANT
ALL files in /opt/etc/logrotate.d/ and /opt/etc/syslog-ng.d/ MUST NOT be writable by anyone other than root. Files that are writable by group or others will be ignored!
Usage
scribe has a number of commands:
I'll try to answer questions and help troubleshoot. I expect this thread will also include discussions on syslog-ng configuration as well. scribe is hosted on GitHub. Syslog-ng Open Source Edition (OSE) is a product of One Identity (https://www.syslog-ng.com/products/open-source-log-management/)
Credits
I've borrowed quite a bit of code from @thelonelycoder and @Jack Yaz, with some from @Adamm and @Xentrk as well. All the well-written stuff is from them. All the crap bits are mine.
Special Thanks
To @elorimer and @Butterfly Bones for offering up their time and resources for alpha testing, including finding a couple really bone-headed mistakes on my part.
2023-04-24
scribe is a script that installs syslog-ng and logrotate from Entware. Filters for various common logs are included, and logrotate files to manage those logs.
NOTE WELL:
Looking at log files to "see if anything is wrong" is counter-productive. Log files are best used to find the cause of a problem, or gain knowledge of how the system works. Just because a log entry "looks strange" or "unexplained", particularly if a new entry occurs after updating the firmware, does not at all mean that there is something wrong. Log entries occur for many reasons, including but not limited to:
- Informational only - this is BY FAR the largest number of entries
- The developers turned on debugging and/or turned up log verbosity for some reason and forgot (or didn't bother) to turn it back off
- The developer thinks people will "obviously" know that certain log entries are just for informational purposes, no matter how poorly worded the entry is
- English is not the 1st (or maybe not even 2nd) language for the developer and the wording of the log entry doesn't accurately reflect the developer's intent
- Many "meaningful" log entries don't actually matter - a prime example of this is the well-known "dcd_tainted" crash an AC86U routers. While it does create a rather large number of log entries, it has no discernible effect at all on the router operation; if the log entries stopped with a firmware upgrade, you would not be able to tell if the developers actually fixed the problem or decided to "fix" it by simply suppressing the log entries
- ASUS, like most routers, runs a stripped-down version of the Linux kernel, and the router doesn't have certain hardware that a normal PC does, so sometimes it may report not finding services or hardware that were never there in the first place
Requirements
Asuswrt-Merlin version 380.68 or later running on a supported router with Entware installed. jffs scripts must be enabled, although Entware installation should have taken care of this.
IMPORTANT:
1: If you use Diversion, you must update Diversion to v4.1.0 or later for new installations.
2: If you intend to use Skynet, but have not installed it yet, it is preferred to install Skynet before installing scribe.
3: If you use Skynet, v6.9.2 or later is required.
4: It is not possible to update from scribe v1.0_0 (or earlier) without forcing a reinstall.
Installation
SSH into your router and run the following:
Code:
/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/cynicastic/scribe/master/scribe" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install
A single line is added to /opt/etc/init.d/S01syslog-ng that calls a helper script to kill the klogd and syslogd and make the necessary changes to the filesystem to keep syslogd from causing problems when GUI changes cause it to restart.
A single line is added to /jffs/scripts/service-event to call scribe and check for syslogd and klogd being restarted after either the "logger" or "time" services are (re-)started.
If Skynet is installed, a syslog-ng configuration file is also installed for it, and Skynet is automatically pointed at the new location for the iptables output. If you plan to install Skynet, it is highly preferable to install Skynet before scribe.
Options
A customized syslog-ng.conf file will be installed. This syslog-ng.conf file will remove sourcing a large number of functions from the /opt/share/syslog-ng/include/scl directory, change maximum log message size to 16K, and set stats frequency to every 6 hours. If installed, it copies the syslog-ng.conf file that came with the package to /opt/share/syslog-ng/examples.
Example Files
Of note, example files are placed in /opt/share/sylog-ng/examples/ and /opt/share/logrotate/examples/ for common programs (skynet, pixelserv-tls, etc). These can be copied directly to /opt/etc/syslog-ng.d/ and /opt/etc/logrotate.d/ for use. Do not blindly copy all of these files to their respective ".d" directories however, as doing so will prevent syslog-ng from running. Editing files directly here is not recommended as they will likely be overwritten if you choose to update the filters.
IMPORTANT
ALL files in /opt/etc/logrotate.d/ and /opt/etc/syslog-ng.d/ MUST NOT be writable by anyone other than root. Files that are writable by group or others will be ignored!
Usage
scribe has a number of commands:
- install - can be used to force re-installation of syslog-ng, logrotate, and scribe. Doing so will overwrite any customizations you have made to the script files included for syslog-ng and logrotate.
- uninstall (or remove) - removes syslog-ng, logrotate, and scribe from your system. Doing so will erase any files you have added to /opt/etc/syslog-ng.d and /opt/etc/logrotate.d.
- update - updates the scribe script, asks to update filters.
- show-config (or config) - shows the complete combined configuration for syslog-ng including all included files in the system list utility.
- status - checks to see if syslog-ng is running and if logrotate is in the crontab (cru). Also displays the scribe script version. Also checks the syntax of the syslog-ng configuration as it exists on the disk, which may be different than what is loaded if "restart" (see below) has not been run since changing the configuration files.
- reload - reloads syslog-ng, which is necessary when changing configuration files.
- restart - restarts syslog-ng Will start syslog-ng if it is not currently running.
- debug - create a debug file and tar.gz it to allow debug info to be sent easily.
I'll try to answer questions and help troubleshoot. I expect this thread will also include discussions on syslog-ng configuration as well. scribe is hosted on GitHub. Syslog-ng Open Source Edition (OSE) is a product of One Identity (https://www.syslog-ng.com/products/open-source-log-management/)
Credits
I've borrowed quite a bit of code from @thelonelycoder and @Jack Yaz, with some from @Adamm and @Xentrk as well. All the well-written stuff is from them. All the crap bits are mine.
Special Thanks
To @elorimer and @Butterfly Bones for offering up their time and resources for alpha testing, including finding a couple really bone-headed mistakes on my part.
Last edited: