Using Databases for event logging

"White, Phil via Exim-users" <[email protected]>
Newsgroups gmane.mail.exim.user
Message-ID <CAKsv4qZjH9wvBGzRK-p7K=bBWG6QBPo4_aQWWNSAK87r+9W-sg@mail.gmail.com>
Hi All,

What is the correct method of connecting to an sqlite3 database?
Also, what is 'best practice' to secure against SQL injection?

I am trying to write event data, starting off with a very simple
configuration in my main exim.conf file:

LOGDB   = /var/log/mail/data.db
# LOGDB set because value used on more than one occasion: it makes
changing the configuration later simpler.
event_action    = ${lookup sqlite {file=LOGDB
         \
                  INSERT INTO exim_log (timestamp,host,msg) VALUES (
         \
                    '$tod_log'
         \
                  , '$host_address'
         \
                  , '(M) ${event_name}: ${event_data} '
         \
                );}}

This produces an entry in the panic.log
1uPMnA-000000006oD-1Iin failed to expand event_action msg:complete in
main: absolute file name expected for "sqlite" lookup

Ultimately (once testing is complete), I may transfer over to a
postgresql database. Would this change the answer/advice?
If helpful, Exim version 4.98.2

Many thanks,
Phil

-- 
## subscription configuration (requires account):
##   https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
##   [email protected]
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.