Answer the question
In order to leave comments, you need to log in
How to send logs from nginx?
What is this all for?
There is a small service that filters requests according to certain conditions and enters ip into iptables.
Is it possible to configure Nginx in such a way that it would pass the data that it writes to the access and error logs to the rest service?
It should work something like this, a request comes in-> the server writes the results to the log + sends the same to the service. How is it better to implement this? There was an idea to write a lua script that would do this. Or can it be done somehow differently?
Answer the question
In order to leave comments, you need to log in
There is FileBeat https://www.elastic.co/products/beats/filebeat , it is mainly used with logstash. But check it out, it might be customizable to your needs. It reads the logs that nginx writes, for example, and passes it on wherever you tell it
We send all our logs to logstash (we look at kibana)
Previously, we used logstash-forwarder ( https://github.com/elastic/logstash-forwarder) , written in golang, you can take it and rewrite it to fit your needs.
Now we use filebeat, as Sergey Ovechkin said, you can take it as a basis and see it.
You can write your bike in your favorite language.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question