-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable the configuration of the line delimiter for the json output #8
base: main
Are you sure you want to change the base?
Conversation
Logstash does not support GELF via TCP AFAIK. Did you try to build TCP GELF manually using logstash JSON encoding and sending via TCP? |
This is exaclty what I did and it works with the patch I provided in the pull request. filter {
mutate {
add_field => {
"version" => "1.1"
"short_message" => "%{message}"
}
}
ruby {
code => "event['timestamp'] = '%10.3f' % event['@timestamp'].to_f"
}
}
output {
tcp {
host => "127.0.0.1"
port => 12201
codec => json_lines {
line_delimiter => 0
}
}
} Graylog needs the NUL delimiter. I thought the codec would be a goos place to place it. |
Interesting. You basically built GELF TCP support using built-in logstash functionality. Smart! |
Is it possible to integrate the change? I signed the CLA. |
1 similar comment
Is it possible to integrate the change? I signed the CLA. |
I like the idea! I'm not sure about the implementation. Can GELF over TCP be compressed? If so, then this patch will not help us move towards compressed-gelf-over-tcp behavior. Though, if gelf-tcp doesn't support compression, then maybe this is ok to modify in the json_lines codec. Additionally, having the I'm not requiring any of the above changes, but want to at least discuss them a bit before we move forward if that's ok :) |
Once we get through that small discussion, It'd be oh so lovely to have some tests to help us keep this behavior functioning in the future :) |
Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run; then say 'jenkins, test it'. |
I want to use logstash to receive gelf logs from docker over TCP. Having support for NUL delimiter in json and jsonLines codec would be nice for that |
Very late response I know - I am ok with the addition of a @rabam are you still around and would you like to make that change? |
Hi,
I tried to ship messages to a graylog gelf server over the TCP GELF input. Unfortunately it didn't work because Graylog did not accept the messages logstash was sending, both with NUL delimiters and \n delimiters. Might be a bug in graylog-inputs, not sure.
So I tried to patch the logstash codec and it worked like a charm.
You can now do something like this to use
\0
as delimiter:I'm not a ruby star so there might be many better ways to do it.
Can you please take a look at it and eventually merge it or provide a similar functionality.
Thank you!
Max