Request Log middleware
Project description
======================
Requset Log Middleware
======================
Request log middleware to capture meta data associated with each user request into mongo database. The write acknowledgement at time of save to mongo is disabled to ensure there is minimum performance lag due to this middleware.
Note: this is work in progress - expect bugs etc
Requirements
===========
* pymongo
* celery
* Mongo
* Elasti Search
* Tested on Django > 1.3
Setup / Installation
====================
* Install the package using pip
pip install requestlogs
Update settings.py
* Add app 'requestlogs' to your INSTALLED_APPS
* Add 'requestlogs.middleware.RequestLogMiddleware' to MIDDLEWARE_CLASSES after auth
* Set the app name, this will be used in the collection / index etc
RLOG_APP_NAME = 'app' # used to uniquely identify the collection
* Set the engine / db where you want the logs to be captured
RLOG_ENGINE = 'MONGO' or RLOG_ENGINE = 'ELASTICSEARCH'
* For MONGO: Customize the name and mongo connections
RLOG_MONGODB_URI = 'mongodb://127.0.0.1:27017/requestlogs_db?w=0' # mongodb to capture request logs
# mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
# refer: http://docs.mongodb.org/manual/reference/connection-string/
- The collection name will be set to {RLOG_APP_NAME}_request_logs
* For ELASTICSEARCH: Customize the name and connections
ELASTICSEARCH_CONN = [{'host': 'localhost', 'port': 9200}, ]
RLOG_ELASTICSEARCH_TTL = "90d" # set the TTL for auto expiry
- The document type will be set to {RLOG_APP_NAME}-requestlogs
- The index name will be set to idx-{RLOG_APP_NAME}-requestlogs
- For Kibana - a customized dashboard has been created, change the type and index to use it
ToDos
=====
This package is still under development, following are the high level items to be implemented
* Capture custom session variable
* Add views to pull transactions by user
* Add views to search transactions by user and datetime
* Test cases
Requset Log Middleware
======================
Request log middleware to capture meta data associated with each user request into mongo database. The write acknowledgement at time of save to mongo is disabled to ensure there is minimum performance lag due to this middleware.
Note: this is work in progress - expect bugs etc
Requirements
===========
* pymongo
* celery
* Mongo
* Elasti Search
* Tested on Django > 1.3
Setup / Installation
====================
* Install the package using pip
pip install requestlogs
Update settings.py
* Add app 'requestlogs' to your INSTALLED_APPS
* Add 'requestlogs.middleware.RequestLogMiddleware' to MIDDLEWARE_CLASSES after auth
* Set the app name, this will be used in the collection / index etc
RLOG_APP_NAME = 'app' # used to uniquely identify the collection
* Set the engine / db where you want the logs to be captured
RLOG_ENGINE = 'MONGO' or RLOG_ENGINE = 'ELASTICSEARCH'
* For MONGO: Customize the name and mongo connections
RLOG_MONGODB_URI = 'mongodb://127.0.0.1:27017/requestlogs_db?w=0' # mongodb to capture request logs
# mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
# refer: http://docs.mongodb.org/manual/reference/connection-string/
- The collection name will be set to {RLOG_APP_NAME}_request_logs
* For ELASTICSEARCH: Customize the name and connections
ELASTICSEARCH_CONN = [{'host': 'localhost', 'port': 9200}, ]
RLOG_ELASTICSEARCH_TTL = "90d" # set the TTL for auto expiry
- The document type will be set to {RLOG_APP_NAME}-requestlogs
- The index name will be set to idx-{RLOG_APP_NAME}-requestlogs
- For Kibana - a customized dashboard has been created, change the type and index to use it
ToDos
=====
This package is still under development, following are the high level items to be implemented
* Capture custom session variable
* Add views to pull transactions by user
* Add views to search transactions by user and datetime
* Test cases
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
RequestLogs-1.0dev.tar.gz
(7.6 kB
view details)
File details
Details for the file RequestLogs-1.0dev.tar.gz
.
File metadata
- Download URL: RequestLogs-1.0dev.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d316ad4a3bfadd07f9d79a31c942e7d507fb7a1b3fb3f58b37d1adecde5a179 |
|
MD5 | a13f077df7e93061ada9560be1626161 |
|
BLAKE2b-256 | 0b22d9ec8458f922acecc5b0e9fc4eee20e7b95ee1223bbbda2ba3ba24e59acd |