Skip to content

Audit logging microservice that runs as an HTTP endpoint and saves logs in a MongoDB

Notifications You must be signed in to change notification settings

Yomna521/Audit-Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audit Logger

Audit Logging Microservice

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]

Block Diagram

An abstract view of the system. image
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

Deployment

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.

Testing

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:



To test the authentication:

Database

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:



Enviroment

  • Ubuntu 18.04.06 (VMware Workstation 16)
  • Python 3.8
  • MongoDB (pymongo)

Possible Improvement

  • Deploying on a remote host instead of the local host
  • Containerizing the microservice as a docker container
  • Upgrading from the basic HTTP authentication

About

Audit logging microservice that runs as an HTTP endpoint and saves logs in a MongoDB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published