News for hackers. Stuff that matters.
Re:Systemd, ten years later: a historical and technical retr... by theamk on Monday May 04, 2020 @01:39AM (#23064905)
You don't want to use sqlite for logs -- it is way too complex, and in particular, it may roll back (=lose log entries) if it is low on space, and permanently damage data when writing onto disks with errors. It also makes wrong performance tradeoffs for logging -- your choices are either sync() all the time, or roll back on unexpected termination.

I don't like the that journald goes backwards in space and updates indices -- I like "append-only" attribute -- but at least it writes data sequentially one after another, which makes it pretty tolerant of data loss.

As for "without escape hatch", I don't remember any functionality like that? In fact, systemd is full of escape hatches which are documented and supported. Just recently, I had to modify "is computer online" check -- it was amazingly easy, all I had to do was to drop-in a fragment file for the right service. I remember doing the same in upstart -- it was a total pain, requiring reading the source code spread over dozens of undocumented files.

Re:Systemd, ten years later: a historical and technical retr... by saati on Monday May 04, 2020 @02:33AM (#23065159)
No local logging will work without disk space, and if the disk is bad anything can get corrupted.
Re:Systemd, ten years later: a historical and technical retr... by mantap on Monday May 04, 2020 @07:13AM (#23066625)
If you are low on disk space you want something predictable to happen: the oldest logs are deleted and the newest logs are written. This would be a nightmare to achieve with SQLite, as said above it's just way too complicated.
Re:Systemd, ten years later: a historical and technical retr... by sbierwagen on Monday May 04, 2020 @09:17PM (#23075346)
Does logrotate or plain old write() actually handle those error cases by default?

It sounds like you're arguing to use an even more sophisticated logging system than the status quota of blindly writing bytes to disk.

Re:Systemd, ten years later: a historical and technical retr... by saati on Monday May 04, 2020 @08:12AM (#23067010)
If you actually care about your logs you should log to a centralized service anyway, and if any of your computers actually ran out of disk space you should fire your sysadmins/sres for incompetence.
Re:Systemd, ten years later: a historical and technical retr... by dijit on Monday May 04, 2020 @09:14AM (#23067617)
This comment denotes, strongly, the dissonance that occurs when talking about something so general.

It’s my opinion (as an infrastructure type) that centralised binary logging is an absolute necessity above 20 instances.

But that leaves out every person with a laptop, or those people with a very low volume of little instances.

Structured logging is difficult, that’s why logstash is so flexible about input and conversions. And I think that was the impetus for systemd’s journals; to log structurally.

However. The parent is wrong if he thinks decisions should be made under low disk conditions. Having a rotate rule to keep your sliding window of logs to a certain size is fine. But your servers (and laptops, and desktops) should not be taking arbitrary decisions based on this kind of condition.

Re:Systemd, ten years later: a historical and technical retr... by secabeen on Monday May 04, 2020 @12:34PM (#23070096)
> This comment denotes, strongly, the dissonance that occurs when talking about something so general.

> It’s my opinion (as an infrastructure type) that centralised binary logging is an absolute necessity above 20 instances.

> But that leaves out every person with a laptop, or those people with a very low volume of little instances.

Yep, it also leaves out people on embedded hardware, and on devices that are in remote locations without access to the Internet, or in a car, or on metered Internet, etc. It's hard to hold in your head just how broadly Linux is used these days.

Re:Systemd, ten years later: a historical and technical retr... by realusername on Monday May 04, 2020 @01:55AM (#23064965)
Sqlite is battle-tested though, it has one of the most comprehensive test suite and is used on billions of devices already.

What systemd is doing with this log storage system is reinventing sqlite, because systemd has a fairly new and not battle-tested database implementation, it has shortcomings.

I would argue that either they use plain text logs like before or use sqlite but they should not reinvent a new db.

Re:Systemd, ten years later: a historical and technical retr... by adwn on Monday May 04, 2020 @08:48AM (#23067307)
> Sqlite is battle-tested though, it has one of the most comprehensive test suite and is used on billions of devices already.

That's great, but you've completely ignored theamk's argument that sqlite is the wrong tool for the job.

Re:Systemd, ten years later: a historical and technical retr... by realusername on Monday May 04, 2020 @10:32AM (#23068514)
I don't agree with that argument, sqlite is totally the right tool for the job, it provides consistency, reliability, an api you can query anything upon, transactions, indexing, tools... And fits into files.

You currently can't trust systemd log storage at all, even on my own laptop it manages to have some corruption... Querying is very poor and inefficient, indexing is unreliable... And that's exactly what I expect, building a database is hard.

Re:Systemd, ten years later: a historical and technical retr... by growse on Monday May 04, 2020 @10:47AM (#23068694)
SQLite doesn't work reliably on NFS, which rules it out for any PXE-booted system with an NFS root.
Re:Systemd, ten years later: a historical and technical retr... by SQLite on Monday May 04, 2020 @11:08AM (#23068945)
The issue with NFS and SQLite is that posix advisory locks do not work, or do not work well, on many NFS installations. As long as advisory locks work over NFS, or as long as there is only one client trying to access the database at a time, so that locks are not really needed, SQLite works fine over NFS. NFS is a lot slower, but that's just the nature of NFS and SQLite can't do anything about that.

You can ask SQLite to use dot-file locking instead of posix advisory locking. Or you can ask it to simply ignore locking all together. In both cases, SQLite will work on even a broken NFS system, though with the corresponding concurrency limitations.

Re:Systemd, ten years later: a historical and technical retr... by growse on Monday May 04, 2020 @12:22PM (#23069934)
Fair. In my experience, the fact that NFS is both pervasive and often broken, for something like a system-wide log manager you can't always assume that your root fs is reliable.

Is dot-file locking a compile- or run-time option?

Re:Systemd, ten years later: a historical and technical retr... by rurban on Monday May 04, 2020 @04:55PM (#23073142)
sqlite is a dirty hack. just because people like hacks doesn't mean it's ready for the serious stuff. it is not. https://research.checkpoint.com/2019/select-code_execution-f...
Re:Systemd, ten years later: a historical and technical retr... by realusername on Tuesday May 05, 2020 @04:20AM (#23077736)
It's certainly more ready than a custom hacked-up database which has data corruption even on my own laptop.