Log system developed as a final challenge during the acceleration of Codenation in partnership with Stone.
The system was developed as a proposal to be an API to centralize the receipt of logs and, thus, improve the management of information about possible problems in the applications where the logs come from.
- Python
- Django
- Django Rest Framework
- Simple JWT
- Swagger UI
- Code Climate
- Travis-CI
- Heroku
- among other tools
- Clone the repository
- Access the application directory
- Create a virtualenv with Python 3.6+
- Activate virtualenv
- Install the dependencies
- Configure the instance with .env
- Run migrate
- Run the tests
- Create a superuser
- Start django
git clone https://github.com/carlos-moreno/logs-system.git
cd logs-system
python -m venv .logs-system
source .logs-system/bin/activate
pip install -r requirements.txt
cp contrib/env-sample .env
python manage.py migrate
python manage.py test
python manage.py createsuperuser
python manage.py runserver
|----------------------------------------------------|
| Description | URLS |
|----------------------------------------------------|
| Documentation | / |
| List Users | /api/v1/users/ |
| Create User | /api/v1/users/ |
| Get user specific | /api/v1/users/{id}/ |
| Update User | /api/v1/users/{id}/ |
| Delete User | /api/v1/users/{id}/ |
| List Agents | /api/v1/agents/ |
| Create Agent | /api/v1/agents/ |
| Get Agent specific | /api/v1/agents/{id}/ |
| Update Agent | /api/v1/agents/{id}/ |
| Delete Agent | /api/v1/agents/{id}/ |
| List Events | /api/v1/events/ |
| Create Event | /api/v1/events/ |
| Get Event specific | /api/v1/events/{id}/ |
| Update Event | /api/v1/events/{id}/ |
| Delete Event | /api/v1/events/{id}/ |
| Get token | /api/v1/get_token/ |
| Refresh token | /api/v1/refresh_token/ |
|----------------------------------------------------|
|--------------------------------------------|
| Endpoints | Verbs |
|--------------------------------------------|
| /api/v1/users/ | GET, POST |
| /api/v1/users/{id}/ | GET, PUT, DELETE |
| /api/v1/agents/ | GET, POST |
| /api/v1/agents/{id}/ | GET, PUT, DELETE |
| /api/v1/events/ | GET, POST |
| /api/v1/events/{id}/ | GET, PUT, DELETE |
| /api/v1/get_token/ | POST |
| /api/v1/refresh_token/ | POST |
|--------------------------------------------|
- List all users
GET >> http://localhost:8000/api/v1/users/
- Create a new user
body example
{
"first_name": "Fulano",
"last_name": "de Tal",
"email": "[email protected]",
"password": "fulano123"
}
POST >> http://localhost:8000/api/v1/users/
- Get user token
body example
{
"email": "[email protected]",
"password": "fulano123"
}
POST >> http://localhost:8000/api/v1/get_token/
- List agents filtering by status
GET >> http://localhost:8000/api/v1/agents/?status=true
- List events filtering by level
GET >> http://localhost:8000/api/v1/events/?level=CRITICAL
- List events sorted by level
GET >> http://localhost:8000/api/v1/events/?ordering=level
If desired, the postgres database can be used in a docker container. To do this, simply set the DATABASE_URL variable pointing to the data in the docker-compose file and run the docker-compose.yml file as follows:
docker-compose -f docker-compose.yml up -d