Audit Trail Implementation in ASP.NET Core Web API

preview_player
Показать описание

Hi everyone. My name is Marinko Spasojevic and in this video, I will show you the proper way of implementing an audit trail in ASP.NET Core Web API.

An audit trail refers to the record of all activities that the users perform in an application. We use it to identify who accessed the application, what changes were made, etc.

An audit trail typically includes the information about:

The author of the change
The date and time of the change
The type of change
The changed data

We can store audit trail data in databases, files, storage services, etc. The most common way is to store this kind of data in the application database and we are going to learn how to do that.

FOLLOW US ON SOCIAL MEDIA!
Рекомендации по теме
Комментарии
Автор

Thank you all for watching and for your support.

CodeMaze
Автор

Good afternoon, always happy to learn new things with your videos. Based on your experience, should some migration or backup be implemented from time to time to prevent this table from becoming huge? I understand that everything is relative but to at least have an idea

andresbeltran
Автор

So this is a bit of an "old school" way to do this. There are better options, in my opinion. The biggest issue I have with this approach is that it only supports add/update/delete actions. Most real world audit requirements involve logging read access also. Further, you're using the HTTPClient directly in the data access layer - it would definitely be a more "pure" approach to avoid that and pull the user information from the ThreadPrincipal, for example, instead.

marklnz
Автор

great tutorial.

Can you tell me considering high performance what database we should use? PostgreSQL or ELK?

pieceofcode_
Автор

Great tutorial, I've been using this technique for a long time.

Totti
Автор

How can I use this approach with a service layer or with unit of work?

GustavoAdolfoRodríguezBeteta
Автор

Great stuff, as usual. We have a nearly identical implementation except for the part where, instead of the changes column, we save entity JSON, so if something needs to be compared, simply compare the JSON objects to see what changed. Also, you can retrieve a deleted object.

seldomseen_
Автор

Really great stuff, man. Thank you very much!

progressnwimuelekara
Автор

Hi, Do you have the source code on GitHub? Please, if you can share it??

venkyv