-
Notifications
You must be signed in to change notification settings - Fork 154
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
New Kafka tailer #16
base: master
Are you sure you want to change the base?
New Kafka tailer #16
Conversation
Hi Mikhail, thanks a lot for your PR. I think it's a great idea to provide different inputs, and Kafka could be a good addition (especially for Microservice architectures). |
Hi Mikhail, I tried out your Kafka tailer and it worked well. However, I am new to Kafka, and I have a question regarding the message format. From what I understand, Kafka does not enforce any particular format for event data. The first example in the official quickstart (step 4) uses unstructured text messages, and generally Kafka seems to work fine with JSON, XML, or other formats. So to me, Kafka and JSON seem to be independent of each other. It might be a good idea to implement JSON support for grok_exporter (parsing log files containing structured JSON data), but I don't think it should be coupled with the Kafka tailer. That means, if you have JSON messages coming out of Kafka, and grok_exporter doesn't explicitly support JSON yet, you would need to parse JSON with grok expressions. What do you think, can we remove JSON support from the Kafka tailer and maybe introduce it later as a general grok_exporter feature? |
1f0b437
to
7dab124
Compare
cf67c51
to
694910a
Compare
d53e0a7
to
ad188fd
Compare
b661e7b
to
09fa4c4
Compare
b769ec2
to
50bbec7
Compare
Any updates on this PR? I also have a hard requirement for this feature. Thanks! |
@hartfordfive unfortunately no update. I still think that "tailers" should be independent of the "log line format", and therefore I'd find it better to decouple the Regarding your question on the Kafka client library in #43: I agree that if samara is more widely used and more frequently maintained this would be preferable. In grok_exporter the only dependency to the Kafka client library should be in Would you like to work on this? That'd be awesome. |
I could definitely look into this and yes I agree the integration should not base itself on a specific message format as it could be in any format, although JSON is typically used with an ELK stack. I myself would definitely benefit from this Kafka integration as most logs I work with from all hosts and applications are published to their respective Kafka topics, which are later indexed in Elasticsearch. Instead of having a second application on each host reading the same byte stream (and consuming additional resources) I can simply consume the logs from these these topics on completely separate processing hosts. I'll base myself on what was submitted to give myself a head start and switch the client library over to samara. Will get back to you once I have a PR ready. |
So I've started working on the code (please see my changes in the kafka-tailer branch in my fork), although now when I'm trying to build, the following error occurs:
Seems as if that struct property doesn't exist in the v3 config. Am I missing something or should I not have based my PR off your master branch? Keep in mind the PR is completed yet, I'm just trying to get past this issue. I appreciate the help! |
You forked off your new branch from the "configurable sliding window" commit that added the |
Ok so I've got an initial version working on this branch although there's a few issues I still need to solve:
Thanks! |
|
The issue is that the kafka tailer should be notified when the grok_exporter intercepts the kill signal so that it can gracefully terminate the consumer client. The following and then consequently cause the for loop within the goroutine to return: which then eventually allows the client to gracefully close: If the tailer's |
It is risky to rely on the file tailers' There is even a known issue in Windows, and the shutdown test is skipped on Windows because grok_exporter/tailer/fswatcher_test.go Lines 932 to 935 in dda32d7
We should avoid relying on I suspect that graceful shutdown of the sarama client is not necessary if all we want is to terminate the application. We don't need to care about potential memory leaks or hung goroutines, because I'm pretty sure it's safe not to install a signal handler for |
In my company we have the log stream as kafka topic.
That is why i added kafkaTailer module so grok_exporter can connect to kafka and feed grok with logs from kafka.