
Couple of solutions come to mind: 1. If this seldom happens the easiest solution would be to do nothing 2. Logger gem has support for 'period-based rotated logging'. The 'daily' option seems perfect 3. Switch from logrotate to syslog-ng, I have not used this myself but it seems to have an option for lossless rotation 4. Add important events that you never want to miss to a table in the database 5. Use an elaborate logging solution consisting of for instance: fluent-bit to collect log entries from your application loki to ingest/store log entries grafana to visualize/monitor/etc logs When using (managed) kubernetes this is pretty easy to set up. If you are going this way it might also be a good idea to use the 'semantic-logger' gem to generate log entries in json format. This way you can easily add more context to log entries and use this in grafana. On 04-08-2023 11:55, Peter Hickman via ruby-talk wrote:
Presently our applications use the standard Logger package that comes with Ruby and it works just fine. We use it in conjunction with the standard unix logrotate. Up to now everything has been working as expected
Until the logrotate hit in the middle of some significant processing and a client had a query. What we found was a 2 second gap in the logs. The end of the old log was the start of a transaction and the start of the new log was the end of a completely different transaction. So we have lost partial information from two transactions and it is possible that there was at least one transaction between these two that was lost completely. Each transaction takes around 1 second to process, sometimes less
This time it was not too big an issue and there were other ways to investigate the problem
Is there some other way of logging that is even less likely to lose data?
______________________________________________ ruby-talk mailing list --ruby-talk@ml.ruby-lang.org To unsubscribe send an email toruby-talk-leave@ml.ruby-lang.org ruby-talk info --https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-talk.ml.ruby-lang.org...