[syslog-ng] MongoDB destination driver
Gergely Nagy
algernon at madhouse-project.org
Sun Jan 2 00:51:05 CET 2011
> This is why I asked in my earlier mail if it's possible to set up the
> mongo driver to log all vars in a message or a subset of vars in a
> message. I was hoping it'd be possible for the schema to change somewhat
> dynamically based on what's present in the messages.
You can set it up to log a set of vars, and it will only actually
insert the non-empty values.
Say, if you have something like this:
destination d_mongo {
mongodb(
keys("host", "program", "pid", "message")
values("$HOST", "$PROGRAM", "$PID", "$MSGONLY")
);
};
If a message does not contain a PID, then that will not be added to
the document, only the rest.
Thus, if you set a maximum of vars, that'll do just what you need, and
only add those that do have a value.
To the best of my knowledge it is not possible to log all available
variables (that would be bad too, since there are overlapping macros),
but you can set up a selected maximum set, and the driver will Do The
Right Thing, and only store those parts of it, that are set.
More information about the syslog-ng
mailing list