Same reason you’d reach for SQL when querying relations - a good enough tool designed for the job.
The problem has always been getting facts into the prolog system. I’ve been looking for a prolog which is as easy to embed in eg Python or node as a Postgres client and… crickets.
I dunno which postgres client you're thinking of but:
https://github.com/tau-prolog/tau-prolog
https://pyswip.org/ https://www.swi-prolog.org/packages/mqi/prologmqi.html
Unfortunately the tau site's certificate seems to have lapsed sometime in the last week or so, but I swear it's actually very good.
Prolog has very little syntax, usually it's not particularly hard to serialise your data structure directly into Prolog code and consult it. If your data is streaming you might have to resort to assert/asserta/assertz/retract, depending on your use case.
log("2024-10-22", "09:09:23", "Mozilla", "/login").
log("2024-10-23", "09:09:24", "Safari", "/dash").
log("2024-10-24", "09:09:25", "Chrome", "/user").
log("2024-10-25", "09:09:26", "Brave", "/login").
Implementing a transform of a web server log file into Prolog can be as simple as this. In practice you'll have more like ten or twenty fields, of course. Then you can query along the lines of log(Date, Time, "user agent constraint", Resource). and don't have to be as diligent as when stacking grep:s or such.If you already keep all your logs in analytics databases the example isn't very good, but it ought to be easy to see how this trivial technique can be applied elsewhere.