Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

syslog-ng ignores the database defined in syslog-ng.conf and instead uses the default database of the user when logging to MSSQL destination.

destination d_mssql {
sql(type(mssql)
        host("myhost") username("myuser") password("mypass")
        database("syslogng")
        table("msgs_${R_YEAR}${R_MONTH}${R_DAY}")columns(
                "seqnum bigint",
                "datetime varchar(16)", "host varchar(32)",
                "program varchar(32)", "pid varchar(8)", "priority varchar(10)", "facility varchar(10)", "pri int",
                "message varchar(max)")
        values("$SEQNUM", "$R_DATE", "$HOST", "$PROGRAM", "$PID", "$PRIORITY", "$FACILITY", "$PRI", "$MSGONLY")
        indexes("datetime", "host", "program", "pid"));
};

As you can see I want to use "syslogng" as my database but what happens is that syslog-ng uses the default database ("master") configured for "myuser" in MS SQL Server.

If I change the default database for "myuser" in SQL server to "syslogng", then it will write to "syslogng" database. But this is not what I want. I want to be able to configure the database in syslog-ng.conf.

Any ideas why this is happening?

Same question on BalaBit community website.

share|improve this question

1 Answer 1

To get around this, in my sql() statement I set:

database("")

Then use the full path to the table I want to create/update:

table("syslogng.msgs_${R_YEAR}${R_MONTH}${R_DAY}")")

Use a DB browser, like DBeaver, to connect to you MSSQL DB and determine the full path to your table.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.