I'm interested in having postfix log directly to a mariadb or mongodb database so I can then query it for different info like sender, recipient and subject, etc. Does anyone know the best way to go about doing this?
I don't know if this is the best way, but one option is to send all mail logs from rsyslog to a custom script, have that script parse the log line and save it to your database.
postfix -> rsyslog -> script -> sql For Redhat flavor OS: /etc/rsyslog.d/custom.conf: mail.* ^/etc/rsyslog.d/your_script_that_saves_to_sql
