Open Wilsonator123 opened 6 months ago
I don't know 🤷
Logging is the storing of information to do with the operating of a systems. It can be used in multiple different ways and can contain different information. We use it to monitor and record actions taken on our system, whether by users or internal objects.
[!info] Example We can use logging to store all requests made to a database.
Within that log we could have a timestamp, the table / columns accessed, method (query) used, status (outcome) of the query, information on the user and more.
There a reasons why we use logging:
These methods revolve around the fact that logging can inform developers of how the systems is being used which can help increase security as it helps identify vulnerabilities, strange activities, and possible breaches
Look inside yourself and find the answer 🙏 There are 4 questions that we ask when logging:
Information about when the event occurred
- Log timestamp (UTC)
- *Interaction identifier 1
Where
Where did the event come from
- Application Name
- Location
- Where did the event originate (HTTP/ URL)
- Code location, script name
Who
Who is making the request (user or machine)
- Source address (IP, Application, Device)
- User identity (if available), user table primary key
What
What was the event
- Type of even 2
- Severity 2
- Description
- Reason
- Result Status (or HTTP Status)
User Type
1 - Interaction Identifier is a way to identify that links the user interaction with the event. E.g. of form submit, on button click, page request
2 - We need to create a list of types and severities which will link to the event e.g. 0=emergency, 1=fatal, 2=error 0=db read, 1=db write, 2=db modify, 3=db deletion etc.
To be discussed!
Create a middleware on the backend