In syslog-ng, how can I type-hint a json field as an integer for use in a sql destination?
up vote
0
down vote
favorite
I am trying to send a JSON-format source to a sql destination using syslog-ng. The source has some text fields, and some integer fields.
When I use the json-parser I'm able to individually address each key/value, but the json-parser converts all the fields to strings.
Because the sql destination doesn't allow for type hinting, how can I send a value from my json-parsed message as an integer?
I've tried using a rewrite like this, but it doesn't work:
rewrite r_dns {
set(
"flow_id",
value( "int64(${.json.flow_id})" )
);
};
Ideally I would like to do something like this, but the sql dest doesn't have such an option:
sql(
...
columns(flow_id BIGINT)
values(int64(${.json.flow_id}))
)
syslog-ng
add a comment |
up vote
0
down vote
favorite
I am trying to send a JSON-format source to a sql destination using syslog-ng. The source has some text fields, and some integer fields.
When I use the json-parser I'm able to individually address each key/value, but the json-parser converts all the fields to strings.
Because the sql destination doesn't allow for type hinting, how can I send a value from my json-parsed message as an integer?
I've tried using a rewrite like this, but it doesn't work:
rewrite r_dns {
set(
"flow_id",
value( "int64(${.json.flow_id})" )
);
};
Ideally I would like to do something like this, but the sql dest doesn't have such an option:
sql(
...
columns(flow_id BIGINT)
values(int64(${.json.flow_id}))
)
syslog-ng
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to send a JSON-format source to a sql destination using syslog-ng. The source has some text fields, and some integer fields.
When I use the json-parser I'm able to individually address each key/value, but the json-parser converts all the fields to strings.
Because the sql destination doesn't allow for type hinting, how can I send a value from my json-parsed message as an integer?
I've tried using a rewrite like this, but it doesn't work:
rewrite r_dns {
set(
"flow_id",
value( "int64(${.json.flow_id})" )
);
};
Ideally I would like to do something like this, but the sql dest doesn't have such an option:
sql(
...
columns(flow_id BIGINT)
values(int64(${.json.flow_id}))
)
syslog-ng
I am trying to send a JSON-format source to a sql destination using syslog-ng. The source has some text fields, and some integer fields.
When I use the json-parser I'm able to individually address each key/value, but the json-parser converts all the fields to strings.
Because the sql destination doesn't allow for type hinting, how can I send a value from my json-parsed message as an integer?
I've tried using a rewrite like this, but it doesn't work:
rewrite r_dns {
set(
"flow_id",
value( "int64(${.json.flow_id})" )
);
};
Ideally I would like to do something like this, but the sql dest doesn't have such an option:
sql(
...
columns(flow_id BIGINT)
values(int64(${.json.flow_id}))
)
syslog-ng
syslog-ng
edited Nov 22 at 13:26
asked Nov 21 at 23:51
wcal
33
33
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422062%2fin-syslog-ng-how-can-i-type-hint-a-json-field-as-an-integer-for-use-in-a-sql-de%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown