Skip to content
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

integration with Serilog.AspnetCore.Ingestion #181

Open
tusanesen opened this issue Apr 1, 2021 · 5 comments
Open

integration with Serilog.AspnetCore.Ingestion #181

tusanesen opened this issue Apr 1, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@tusanesen
Copy link

There is a packet called Serilog.AspNetCore.Ingestion which is a sort of a relay to integrate clientSide serilog to the server side one seemlessly. So that logs post by client are directed to the serilog pipeline configured on the server. Only problem for http-sink to work with it is that it expects new line delimeted logs which requires one more batchFormatter..

Thanks

@tusanesen tusanesen added the enhancement New feature or request label Apr 1, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2021

Hi there and welcome to this repository!

A maintainer will be with you shortly, but first and foremost I would like to thank you for taking the time to report this issue. Quality is of the highest priority for us, and we would never release anything with known defects. We aim to do our best but unfortunately you are here because you encountered something we didn't expect. Lets see if we can figure out what went wrong and provide a remedy for it.

@FantasticFiasco
Copy link
Owner

Hi!

This sink comes prebuilt with two batch formatters, DefaultBatchFormatter and ArrayBatchFormatter. The JSON format they produce can be found here. Can you define the format you would like your formatter to produce?

@tusanesen
Copy link
Author

Hi..

I tried with the message below, it worked.
{ event n }
{ event n+1 }

When I look at the code, that message with line seperated objects provide a kind of convenience to get those objects in a async while loop, as follows

var reader = new StreamReader(context.Request.Body);
var line = await reader.ReadLineAsync();
while (line != null)
{

Ref: https://github.com/nblumhardt/serilog-sinks-browserhttp/blob/dev/src/Serilog.AspNetCore.Ingestion/AspNetCore/Ingestion/SerilogIngestionMiddleware.cs

Thanks ..

@FantasticFiasco
Copy link
Owner

Thanks for specifying the format.

Given that Serilog.Sinks.BrowserHttp still is in an experimental stage, I won't add this batch formatter until it has gotten some traction by the community. But until then you can write the batch formatter yourself and keep it in your codebase. Writing it is really easy, just copy from ArrayBatchFormatter.Format and modify it according to your needs.

I'll leave this issue open to see if other developers feel like you do. Thanks for bringing this issue to my attention!

@tusanesen
Copy link
Author

Yes I did my stuff. just wanted to notify you.
thanks..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants