Compare commits
3
Commits
7cdbc30d41
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcbb45c2c2 | ||
|
|
3b687e0ef8 | ||
|
|
67209fa091 |
No files matched your search
@@ -1,41 +1,20 @@
|
|||||||
# Python Nginx Log Analyzer
|
# Python Nginx Log Analyzer
|
||||||
|
|
||||||
<h1 align="left">Hey 👋 What's up?</h1>
|
###
|
||||||
|
|
||||||
|
<p align="left">Python Nginx Log Analyzer:</p>
|
||||||
|
This is a Python Script to download Log Files from a Nginx Proxy Manager Instance or Machine, Analyze and cut the Lines of the Logs into there separate Strings an insert it into SQLite Database.
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
<p align="left">My name is ... and I'm a ..., from ....</p>
|
<h2 align="left">Script Informations:</h2>
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
<h2 align="left">About me</h2>
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
- SSH Connection to the Machine to download Logs File (incl. Log Archives)
|
||||||
|
- Insert all Informations from Log Files into Database (SQLite)
|
||||||
|
|
||||||
<p align="left">✨ Creating bugs since ...<br>📚 I'm currently learning ...<br>🎯 Goals: ...<br>🎲 Fun fact: ...</p>
|
<p align="left">✨ Creating bugs since ...<br>📚 I'm currently learning ...<br>🎯 Goals: ...<br>🎲 Fun fact: ...</p>
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
<h2 align="left">I code with</h2>
|
<h2 align="left">I code with Love and Errors</h2>
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
<div align="left">
|
|
||||||
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/javascript/javascript-original.svg" height="40" alt="javascript logo" />
|
|
||||||
<img width="12" />
|
|
||||||
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/typescript/typescript-original.svg" height="40" alt="typescript logo" />
|
|
||||||
<img width="12" />
|
|
||||||
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/react/react-original.svg" height="40" alt="react logo" />
|
|
||||||
<img width="12" />
|
|
||||||
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/nextjs/nextjs-original.svg" height="40" alt="nextjs logo" />
|
|
||||||
<img width="12" />
|
|
||||||
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/storybook/storybook-original.svg" height="40" alt="storybook logo" />
|
|
||||||
<img width="12" />
|
|
||||||
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/nodejs/nodejs-original.svg" height="40" alt="nodejs logo" />
|
|
||||||
<img width="12" />
|
|
||||||
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/nestjs/nestjs-plain.svg" height="40" alt="nestjs logo" />
|
|
||||||
<img width="12" />
|
|
||||||
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/jest/jest-plain.svg" height="40" alt="jest logo" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
###
|
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
## Import Libaries & Local Modules
|
## Import Libaries & Local Modules
|
||||||
import logging
|
import logging
|
||||||
from modules.class_import_dotenv import ImportDotenv
|
from modules.class_import_dotenv import ImportDotenv
|
||||||
|
import modules.class_database as log_db
|
||||||
|
|
||||||
## Run Script
|
## Run Script
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@@ -28,6 +29,7 @@ if __name__ == "__main__":
|
|||||||
logging.basicConfig(filename=variables['LOG_FILE'], level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
logging.basicConfig(filename=variables['LOG_FILE'], level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||||
|
|
||||||
# Create Database (SQLite DB)
|
# Create Database (SQLite DB)
|
||||||
|
log_db()
|
||||||
|
|
||||||
# Check SSH Connection
|
# Check SSH Connection
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,28 @@
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
class LogDatabase():
|
class LogDatabase():
|
||||||
|
|
||||||
def __init__(self,database_host,database_username, database_password, database_name):
|
def __init__(self,database_host,database_username, database_password, database_name, log_mode):
|
||||||
|
|
||||||
self.database_host = database_host
|
self.database_host = database_host
|
||||||
self.database_username = database_username
|
self.database_username = database_username
|
||||||
self.database_password = database_password
|
self.database_password = database_password
|
||||||
self.database_name = database_name
|
self.database_name = database_name
|
||||||
|
self.log_mode = log_mode
|
||||||
|
|
||||||
|
try:
|
||||||
|
if os.path.exists(self.database_name):
|
||||||
|
sqlite3.connect(self.database_name)
|
||||||
|
except Exception as e:
|
||||||
|
if self.log_mode == "1":
|
||||||
|
logging.error(f"Database Error: \n\n {str(e)}")
|
||||||
|
elif self.log_mode == "2":
|
||||||
|
print(f"Database Error: \n\n {str(e)}")
|
||||||
|
|
||||||
|
def db_creation(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def db_inserts(self, data):
|
||||||
|
pass
|
||||||
Reference in new issue
Block a user