Logify is a versatile logging application designed for efficient log management. It seamlessly integrates Elasticsearch and PostgreSQL databases to ingest, store, and query logs. The app provides a user-friendly interface with robust search functionalities, allowing users to explore logs based on various criteria. Additionally, it offers export features for convenient data retrieval and analysis.
- Receives log entries via HTTP POST requests to the
/ingest
endpoint. - Stores log entries in both PostgreSQL and Elasticsearch for persistence and search capabilities.
- PostgreSQL database configuration is specified in the
PostgreSQL_DATABASE_FILE
variable. - Elasticsearch configuration includes host, port, scheme, and client initialization.
- The
create_PostgreSQL_database
function creates a table namedlogs
with columns for various log attributes. - Log entries are inserted into PostgreSQL using
insert_log_entry_PostgreSQL
.
- Log entries are indexed into Elasticsearch using
index_log_entry_elasticsearch
.
- The
/ingest
endpoint receives JSON log entries and processes them.
- Allows users to search and export logs based on specified filters.
- Filters include timestamp range, log level, message, resourceId, traceId, and more.
- Similar to the log ingestor, it uses PostgreSQL for local storage and Elasticsearch for search capabilities.
- The
create_PostgreSQL_database
function creates a table namedlogs
with columns similar to the log ingestor. - The
query_logs_PostgreSQL
function queries logs from PostgreSQL based on specified filters.
- The
query_logs_elasticsearch
function queries logs from Elasticsearch based on specified filters.
- The
query_logs
function decides whether to query logs from PostgreSQL or Elasticsearch based on the number of filters and their types.
- The
full_text_search
function extracts filters from the provided query text using regular expressions.
- The
/export
endpoint allows exporting logs to a CSV file.
- The
/search
endpoint handles user searches, both regular and full-text, returning paginated results.
- The
/export
endpoint is used for exporting the logs.
- Python (version 3.10)
- Flask
- PostgreSQL
- Elasticsearch
git clone https://github.com/yourusername/logify.git
cd logify
pip install -r requirements.txt
Follow these steps to run and interact with the Logify application:
python logify.py
Access the app at http://localhost:5000.
If you'd like to contribute to the project:
- Fork the repository on GitHub.
- Clone your fork of the repository.
- Create a new branch for your feature or bug fix.
- Make changes and commit them to your branch.
- Push your changes to your fork.
- Open a pull request on the original repository.
Feel free to explore additional features, functionalities, or configurations based on your requirements.
This project is licensed under the MIT License - see the LICENSE.md file for details.