Audit Logger serves client systems as an HTTP endpoint, and saves logs in a MongoDB.
Audit Logger is fully coded in python without any frameworks.
Logs are saved as dictionaries consistining of two keys with dictionary values:
- http_request:
- HTTP command
- Client address
- Query [for GET requests]
- event:
- Event sent by client [for POST requests]
An abstract view of the system.
Clients can make HTTP requests to the system's API. The Handler handles these requests:
- POST requests:
- Authenticate client request
- Call a logger instance to construct the log
- Send the constructed log to database
- Send response to client
- GET requests:
- Authenticate client request
- Send query to database
- Call a logger instance to construct the log
- Send the constructed log to database
- Send response to client with results
To deploy the microservice, run the following command on terminal:
sudo python3.8 <./run.py
Now, the server should be running on your local host using port 8000.
Open another terminal to act as the client side.
To test the POST requests, run the curl commands saved in post_requests.sh on terminal:
The server side after excuting the commands:
To test the GET query requests, run the curl commands in get_requests.sh on terminal:
As the service is write-intensive, and the events are open-ended. NoSQL offers the best solution to save the logs.
The object view in MongoDB:
- Ubuntu 18.04.06 (VMware Workstation 16)
- Python 3.8
- MongoDB (pymongo)
- Deploying on a remote host instead of the local host
- Containerizing the microservice as a docker container
- Upgrading from the basic HTTP authentication