When the router is starting up with syslog, before syslog-ng starts, it is logging to /tmp/syslog.log. When scribe starts syslog-ng up, it appends that file to messages, which means all those messages are listed with the May 5 time stamp, because ntp hasn't synced yet.
As I have described before, I zero out messages on startup, and copy syslog.log to a file. When syslog-ng starts up, the second configuration file that is processed (the first is loggly), reads that file and processes those messages first, and then goes on to the other sources. I've noticed that that wasn't working exactly right, so I have improved on it.
Specifically, I've redefined the source to this:
The default log fetch limit is 100, and syslog.log has about 2400 messages, so I was getting other stuff in between and hadn't noticed it. The default for keep-timestamp is yes, so this puts in a time stamp at the time syslog-ng starts processing, which is after the ntp sync has occurred. Follow-freq tells syslog-ng not to look to see if the file has changed every second, but instead every 1,000 seconds, since I never need to look at it twice.
The result is that my messages log starts like so, with a time stamp starting at the time, a good chunk of time after the router actually rebooted, when syslog-ng started:
Whereupon it goes on its merry way. The result is I have a neat record of the current startup sequence. I lose the incrementing May 5 time, since it is all processed so fast, but I keep the order.
As I have described before, I zero out messages on startup, and copy syslog.log to a file. When syslog-ng starts up, the second configuration file that is processed (the first is loggly), reads that file and processes those messages first, and then goes on to the other sources. I've noticed that that wasn't working exactly right, so I have improved on it.
Specifically, I've redefined the source to this:
Code:
source s_startup {
file("/opt/var/log/startup" keep-timestamp(no) log-fetch-limit(3000) follow-freq(1000));
};
The result is that my messages log starts like so, with a time stamp starting at the time, a good chunk of time after the router actually rebooted, when syslog-ng started:
Code:
Jul 30 17:49:07 syslogd started: BusyBox v1.25.1
Jul 30 17:49:07 RT-AC86U kernel: klogd started: BusyBox v1.25.1 (2020-07-30 00:43:28 EDT)
Jul 30 17:49:07 RT-AC86U kernel: Booting Linux on physical CPU 0x0
Jul 30 17:49:07 RT-AC86U kernel: Linux version 4.1.27 (merlin@ubuntu-dev) (gcc version 5.3.0 (Buildroot 2016.02) ) #2 SMP PREEMPT Thu Jul 30 01:57:08 EDT 2020
Jul 30 17:49:07 RT-AC86U kernel: CPU: AArch64 Processor [420f1000] revision 0
....
2400 other messages, until the USB drive is mouinted, entware starts, and syslog-ng gets started by scribe
...
Jul 30 17:49:07 RT-AC86U custom_script: Running /jffs/scripts/post-mount (args: /tmp/mnt/Cruzer)
Jul 30 17:49:07 RT-AC86U kernel: Adding 2097148k swap on /tmp/mnt/Cruzer/myswap.swp. Priority:-1 extents:15 across:2424832k
Jul 30 17:49:07 RT-AC86U Diversion: Starting Entware and Diversion services on /tmp/mnt/Cruzer
Jul 30 17:49:07 RT-AC86U kernel: klogd: exiting
Jul 30 17:49:07 syslogd exiting
Jul 30 17:49:07 RT-AC86U elorimer: Diversion Mounting Diversion WebUI as user1.asp
Jul 30 17:49:08 RT-AC86U Diversion: restarted Dnsmasq to apply settings