[syslog-ng] [PATCH (3.4)] afmongodb: Add support for datetime fields

Gergely Nagy algernon at balabit.hu
Thu Nov 15 16:52:44 CET 2012


Balazs Scheidler <bazsi at balabit.hu> writes:

> destination d_sql {
>
> 	sql(columns('id', 'now datetime', 'bar'),
> 	    values("$ID", default, "$BAR"));
> };
>
> Here, 'default' means to use the default for the column. If
> value-pairs() could grow such a functionality, that would be great.

This is more or less done, although default handling is a bit awkward at
the moment (it needs default("")), and I none of the destinations
support it yet.

> mongodb(
>         value-pairs(
>           key("MESSAGE")
>           pair("some.date", datetime("$UNIXTIME"))))
>
> "datetime" here would only be passed around by value-pairs to mongodb,
> which could interpret various casting methods.

And that's done, too: we recognise int32() (also as int()), int64(),
string() (the default, if omitted), datetime() and boolean(). If so need
be, uint32, and uint64 are easy to add, that covers most things.

I already modified the mongodb destination to support these, and it
works wonderfully. I'll also update the amqp destination too in the next
few hours.

The hard part is figuring out how it should all work for $(format-json),
because that does not use the bison grammar. Most likely, I'll implement
a tiny parser for that case.

I'll post the patchset to the list once I'm done with everything.

-- 
|8]



More information about the syslog-ng mailing list