-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 syslog output #1525
New syslog output #1525
Conversation
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'. |
Thanks @avleen for opening the PR. In general, we're very conservative when it comes to adding more outputs, see for example this (old) discussion. In the meantime, we added Redis and Kafka because they were very often requested, but we don't plan to have lots of output modules like Logstash has. We don't see the request for a syslog output nearly as much as for Redis/Kafka, but it was requested once more relatively recently. May I ask what the use case is, and if using Logstash as an intermediary would be an option? |
Hi @tsg! I read over that discussion, and the reasons are similar, with some distinctions:
We could use Logstash as an intermediary, but that adds an additional moving piece to the infrastructure, which is less desirable. If this additional output makes folks uncomfortable, we could keep a local fork. The code is fairly well isolated from the rest of |
Thanks @karmi ! Just done now :-) |
heya @avleen, looking at this change, and I have concerns. Initially, we wanted to only support ES and LS outputs for libbeat, in order to simplify the scope of libbeat, with the assumption that if other outputs are needed, it will be done through LS. We revisited this plan as people made good points around the architectural importance of supporting queuing, so we decided to take the additional overhead of also supporting certain queue implementations in libbeat. This is a new territory, that I very reluctant for us to get into. First, syslog is, well, hard..., and officially supporting syslog also means taking all the many different variations and end points that might support it. Also, it gets us into non queue based outputs, and here again it will be hard to say no to other formats, which means additional burden on beats (instead of focusing on other improvements) and duplication of efforts between LS and Beats. Is there a reason why you can't have an LS in the middle, beats shipping to it and output to syslog, to support this use case? It might be a good solution for now, and see how it goes from there? This is the first time we heard a request for a syslog output, and would hate to add the support for syslog in libbeat just based on one request. |
Hi @kimchy! Thanks for the response 😄 We thought about adding Logstash in the middle, but there were a couple of reasons we didn't go down that route:
One of the wonderful advantages of {{filebeat}} and {{syslog-ng}} is their incredible performance. If this causes too much of a departure of the Beats design, we completely understand and we're happy to put the work in to maintain this just for ourselves and we can close this PR. We had also considered adding other outputs too (eg HTTP), at which point we start having even more overlap with Logstash features. However, I do think there's value in this overlap. Pushing work out to the edges before events hit Logstash is a decent approach to scaling and has many benefits - I figure this is why Filebeat can do filtering and multi-line joining. Thanks again for your time and insights :-) |
@kimchy, @tsg Thanks! |
@avleen How exactly you want to make outputs more pluggable. There is currently some boilerplate required in order to use Check out filebeat/main.go it's already very minimal. One can have a custom filebeat with custom output plugin like this:
Advantages:
Disadvantages:
I think this is already a good compromise. |
It would be nice if that step could be made easier. For example, by importing plugins at compile time:
Better, if community-plugins could be registered with the help of Elastic:
There could be a version to go along with the specified @avleen, could it answer your needs? That probably would encourage contributions like yours to Beats. |
@kimchy @urso Thanks folks! We actually had a very similar idea in the end, and we're going to do it this way. I think that makes the most sense. It does mean we need to have our own I love @McStork's approach, and having a way to support community plugins like this would be a big advantage I think. That way, Elastic engineers can focus on the core product and the community can be responsible for the other stuff. In the mean time, I'm going to close this pull request. I very much appreciate the time you've all taken on this :-) |
@urso sorry to necrobump this but I think it would be a great idea to publish a sample output plugin end to end into a git repo. It could be something as simple as Syslog, although perhaps, RELP (rsyslog's reliable protocol) could be a better idea as it introduce delivery guarantees. A basic RELP library exists here: |
@trixpan Agree that we probably should provide an example Github repo that will make it easier for people to get started on this and will reduce the input need from our side. I would suggest not create a new output on our side but take an existing one and just put it in a separate repo (like elasticsearch-example output). Otherwise we have a maintance burden again. |
@trixpan Best option would be if there is a community output that followed all our suggestion that we can just point to as reference ;-) |
I don't think I would use RELP/syslog for this though. Maybe some plain TCP/UDP will do. |
We had a need to have Filebeat send logs to a syslog server, so wrote this output for libbeat :-)
If there are any changes/improvements that I can make to help get this accepted, I'd be happy to do them.
There is possibly one suboptimal part: we're using fields as a way to let users configure 3 syslog parameters.
This could be moved into a separate place, but it didn't seem that bad because the output is sending the original log line, as read, rather than converting it to JSON, so the fields doesn't have any meaning in this context.
And if we made the output format (plain text vs json) configurable, then it may make sense to have this in the fields anyway.
Thanks!