syslog-ng
syslog-ng copied to clipboard
Feature request: type-hinting in SQL destination
I'm parsing JSON messages using json-parser, and sending them to a SQL destination. Right now syslog-ng encodes all values as strings; I'd like to send integers to my sql destination.
When I do something like this, I get an error because syslog-ng is sending an integer formatted as a string:
destination d_postgres {
sql(
...
columns(flow_id INTEGER)
values("${.json.flow_id}")
);
};
Indeed this would be useful. It's not on my radar though.
On Mon, Nov 26, 2018 at 5:52 PM Cailen McQuattie [email protected] wrote:
I'm parsing JSON messages using json-parser, and sending them to a SQL destination. Right now syslog-ng encodes all values as strings; I'd like to send integers to my sql destination.
When I do something like this, I get an error because syslog-ng is sending an integer formatted as a string:
destination d_postgres { sql( ... columns(flow_id INTEGER) values("${.json.flow_id}") ); };
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/balabit/syslog-ng/issues/2429, or mute the thread https://github.com/notifications/unsubscribe-auth/AArldgFQsKhHYtDCzP2wYy7OZy8hk_v2ks5uzBw5gaJpZM4YzbUJ .
Understood @bazsi and thanks for replying.
Is there a way you can recommend dealing with this using the current feature set?
Create the table in database manually with desired data types. If tables/columns already exist then syslog-ng does not create any table but uses the existing ones (which will have INTEGER columns)
you can specify types to columns though.
columns('id INTEGER', 'value TEXT') and so on.
We would just be using '10' always, e.g. with the apostrophes present. If the database would convert this automatically to the desired data type, it would work.
On Wed, Nov 28, 2018 at 2:32 PM Wernfried [email protected] wrote:
Create the table in database manually with desired data types. If tables/columns already exist then syslog-ng does not create any table but uses the existing ones (which will have INTEGER columns)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/balabit/syslog-ng/issues/2429#issuecomment-442446607, or mute the thread https://github.com/notifications/unsubscribe-auth/AArldpiwGcUasK6GO1fX56mcyPloApIHks5uzo-lgaJpZM4YzbUJ .
@pycal please assign it to me
@aman566 it is not possible to use the Assignees
field for users outside of balabit
org + issue owner; so claiming in the comment should do. feel free to work on it.
So can I send PR if possible @Kokan
of course
Hi @bazsi ,
I want to work on this issue. Can you give me a brief idea of what changes do I need to make?
I'd want to work on this issue. Please give this problem to me.