Looking for a logging solution
Working on ASP.NET program.
I have a lot of stuff i want to do for logging. First off i want to log every time an endpoint is accessed, who accessed it, when it was accessed what info was passed to the api and the datatype that the endpoint returned. Then there's all the stuff i see in the command line. i would also like to log this stuff. finally i want to be able to query some kind of database of the logs to get data about what's going on, so ideally logs have types and all that jazz. Anyone know any pre existing solutions for this?
I have a lot of stuff i want to do for logging. First off i want to log every time an endpoint is accessed, who accessed it, when it was accessed what info was passed to the api and the datatype that the endpoint returned. Then there's all the stuff i see in the command line. i would also like to log this stuff. finally i want to be able to query some kind of database of the logs to get data about what's going on, so ideally logs have types and all that jazz. Anyone know any pre existing solutions for this?
30 Replies
what
discord died....
ASP.NET specifically or ASP.NET Core?
i swear there was body text...'
ASP.NET core? i think...
so you can use the built in logging framework and configure it more to capture what you need
quick question
can you see the body of my post?
yes
that's how i know you're asking about ASP.NET Core
no like the inital post
see above message
werid... i cant see the body of my own post...
there it is.
so you already have a logging framework built in, you can add middleware to log more information about the request and response, then as far as a searchable log database goes you'd want a log aggregeator like seq or something similar
yes i am using core.
the stuff that shows up in your console is already coming through the logging system, it's just not configured to be written anywhere except the console most likely
something like this?
app.UseMiddleware<ApiLoggingMiddleware>();
more or less
should ApiLoggingMiddleware be implimenting an interface?
it should be implemented in a way that lets you use it as middleware
the issue is i want to save it in such a way i can easily query it, like in a json object or somthing.
yes, structured logging to seq or a similar aggregator will let you do that
um... hows that
look at the docs on writing middleware
i personally replace the microsoft logging with serilog and use its sinks to send the logs to seq
i did have serilog working, but it was just writeing to a txt file, not what i wanted.
serilog can write to tons of different targets
https://github.com/serilog/serilog/wiki/provided-sinks
thxx
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
this looks huge
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered
i swear i will come back to this eventualy :)