serilog / serilog-sinks-file

Write Serilog events to files in text and JSON formats, optionally rolling on time or size
Apache License 2.0
335 stars 117 forks source link

Write logs from file from the remote pc directly to elastic #211

Closed Kirill-basic closed 3 years ago

Kirill-basic commented 3 years ago

Hello! I'm using serilog for logging my apps and ELK stack for saving and monitoring logs. But I have a wpf app that is working on a remote pc and writing logs to the txt file. Once an error occured i want this file to be sent to the API. After this file is received i want all the logs from this file to be sent to elastic. I know that i can save this file to a folder and then send this logs to elastic using filebeat. But is there any way to log this logs to elastic without saving this file? p.s. i know that i can log every log as a log message but in this case i won't be able to filter them in kibana p.p.s i know that i can parse each log and then send all of them to elastic but i hope that there is some default implementation of it, thanks!

cocowalla commented 3 years ago

Have you looked into Serilog.Sinks.Elasticsearch?

Kirill-basic commented 3 years ago

Have you looked into Serilog.Sinks.Elasticsearch?

Yes, i'm using sinks.elastic for my api and it sends its logs to elastic and it works. But i want this api to get logs from the posted file and send it to elastic. Now i have to parse it manualy but i am looking for some default implementation

cocowalla commented 3 years ago

If I understand correctly, you have a WPF app and an API, with the WPF app posting a log file to the API, and you want the API to send those logs to ElasticSearch. If you want to use Serilog, I'd say the "default" implementation here is for your API to parse those logs and write them to a Serilog logger configured to use Serilog.Sinks.Elasticsearch. Otherwise you can ship them to Elasticsearch using filebeat, but that is outside the scope of Serilog.

I hope this helps, and if you have any issues with the Elasticsearch sink, feel free to open an issue in that repo 👍

Kirill-basic commented 3 years ago

Thanks. That's really the answer i've been looking for. Then i'll finish my parser and use it. Again thank you!