Posts

Showing posts from August, 2024

This setup allows you to continuously run the backend service, and every time you make a curl request, it performs the search and returns only the summary information

MongoDB Search Using Flask API Creating a MongoDB Search API Using Flask This post will guide you through setting up a Flask API to search through MongoDB collections based on a search string and return a summary of the results. Step 1: Setting Up the Flask API Create a Python script that sets up the Flask API and connects to MongoDB: Copy code from flask import Flask, request, jsonify from pymongo import MongoClient import re # MongoDB connection settings MONGO_URI = "mongodb://localhost:27017/" DB_NAME = "security_logs" # List of collections to search collections = [ "AlienVaultBlockedIPs", "AlienVaultIDSBlockedIPs", "CSFDenyLogs", "DDoSBlockedIPs", "IDSBlockedIPs", "maliciousDNSBlockedIPs", "OpenRestyAccessLogs", "OpenRestyErrorLogs", "SuricataFullFastLog", &qu