Question about log ordering (system.log)

Started by direx, May 23, 2019, 09:19:36 PM

Previous topic - Next topic
Hi,

I think this might be a general BSD question: I am wondering about the ordering of log entries in OPNsense. Could somebody explain this to me:

# cat /var/log/system.log | awk '{print $1 $2}' | uniq
600:14:56
May16
May17
May18
May19
May20
May21
May22
May23
rc.dyndns:Dynamic
May14
May15
May16
May1CLOG


What I don't understand is:


  • Why is the most current log entry not the last line in the file?
  • Why does the ordering change somewhere right in between the file? It goes from May 23 to May 14.

I am coming from Linux and I have never seen something this odd before. To me it looks like a corrupt file or filesystem, or is this normal?


Thanks,
direx

Hi direx,

Use "clog" instead of "cat". It's a circular log format of fixed size flushing out old entries for new ones. It's not a plain text file.


Cheers,
Franco

Hi Franco,

thanks for the explanation, that makes sense. I felt like a total Unix noob when first using less/grep/cat on these log files :D


- direx

It's non-obvious so no worries. We do have a bit of docs for this nowadays too. :)

https://docs.opnsense.org/manual/logging.html#circular-logs


Cheers,
Franco