Event logging module is a part of the Collaboration system. This module deals with the logging of the user interaction events, such as view an article. This module works as a middleware in Django project and captures and filters the request based on the specification. The logs will be stored in elasticsearch using logstash.
To setup this module with the Collaboration system, perform the following steps:
1. Copy the `eventlog` folder into the root of the main Django project. 2. Go to project's `settings.py` file and in the set of the middlewares add following line:MIDDLE_WARE = [
...,
'evenlog.middleware.Middleware'
]
And, thats all, you are done!
-
Place elasticsearch, logstash, kibana folders of evelog-Docker in the Collaboration-System repository.
-
Replace the docker-compose.yml file of Collaboration-System repository with the evelog-Docker's docker-compose.yml.
-
Go to
eventlog/main/settings.py
and change address and port as follows:
SERVER_CONF = {
...,
"address": "logstash",
"port": 5000,
...,
}
- Run the following commands inside the Collaboration-System repository:
docker-compose build
docker-compose up
- To setup proxy go to
eventlog/main/settings.py
- For
SERVER_CONF
set'use_proxy' = True
. - Specify the proxy configuration as follows:
SERVER_CONF = {
...,
"proxies": {
"http": "http://proxy.cse.iitb.ac.in:80",
"https": "https://proxy.cse.iitb.ac.in:80",
"ftp": "ftp://proxy.cse.iitb.ac.in:80",
}
}
- To add authentication for proxy add follwowing to
SERVER_CONF
else remove it:
SERVER_CONF = {
...,
"proxy_auth": {
"username": "<your-proxy-authentication-name>",
"password": "<your-proxy-authentication-password>"
}
}
Debugging module is defined in utils.py and enables 5 levels of logging along with some color customizations for better viewing.
- To enable debugging go to
eventlog/main/settings.py
. - Set
DEBUG = True
- Install the python client for Elasticsearch using the following pip command:
pip install elasticsearch
- Copy the
search_api
folder into the root of the main Django project. - In the main project's
settings.py
file, add the'search_api'
in the Installed Apps list -
INSTALLED_APPS = [
...,
'search_api'
]
- Also add the following line in the main project's
urls.py
file:
urlpatterns = [
...,
url(r'^logapi/', include('search_api.urls'))
]
- To install the elasticsearchclient add the following in the requirements.text of Collaboration-System Repository
...,
elasticsearch
- In the
search_api/settings.py
, add the elasticsearch hosts in SERVER_CONF
...,
SERVER_CONF = [ "elasticsearch" ]
- Use the URLs to get the required data