Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 58 additions & 58 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
# Local .terraform directories
.terraform/
# .tfstate files
*.tfstate
*.tfstate.*
# Crash log files
crash.log
crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
# Ignore transient lock info files created by terraform apply
.terraform.tfstate.lock.info
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
# Ignore CLI configuration files
.terraformrc
terraform.rc
# Optional: ignore graph output files generated by `terraform graph`
# *.dot
# Optional: ignore plan files saved before destroying Terraform configuration
# Uncomment the line below if you want to ignore planout files.
# planout
.DS_Store
# Ignorer les .venv
.venv
# Ignorer le dossier node_modules
node_modules
logs
email-template.md
venv
# Local .terraform directories
.terraform/

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Ignore transient lock info files created by terraform apply
.terraform.tfstate.lock.info

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc

# Optional: ignore graph output files generated by `terraform graph`
# *.dot

# Optional: ignore plan files saved before destroying Terraform configuration
# Uncomment the line below if you want to ignore planout files.
# planout

.DS_Store

# Ignorer les .venv
.venv

# Ignorer le dossier node_modules
node_modules

logs

email-template.md

venv
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3.8'

services:
python-api:
build: ./python-api
ports:
- "5000:5000"
container_name: log-analyser-api
volumes:
- ./config.json:/app/../config.json

node-client:
build: ./node-client
depends_on:
- python-api
volumes:
- ./config.json:/app/../config.json
container_name: log-analyser-client


10 changes: 10 additions & 0 deletions node-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:18-alpine

WORKDIR /app

COPY package.json .
RUN npm install

COPY . .

CMD ["node", "app.js"]
2 changes: 1 addition & 1 deletion node-client/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

const path = require('path');

// Configuration partagée chargée depuis config.json (à la racine du projet)
const config = require(path.join(__dirname, '..', 'config.json'));
const API_URL = `http://${config.api.host}:${config.api.port}${config.api.route}`;


const axios = require('axios');

async function getLogs() {
Expand Down
12 changes: 12 additions & 0 deletions python-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 5000

CMD ["python", "app.py"]
9 changes: 5 additions & 4 deletions python-api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Chargement de la configuration partagée (config.json à la racine du projet)
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'config.json')

with open(config_path, 'r') as f:
config = json.load(f)

Expand All @@ -15,7 +16,7 @@
# -------------------------------------------------------

def parse_logs(filepath):
errors = []
erreurs = []
warnings = []
infos = []

Expand All @@ -25,17 +26,17 @@ def parse_logs(filepath):
if not line:
continue
if "ERROR" in line:
errors.append(line)
erreurs.append(line)
elif "WARNING" in line:
warnings.append(line)
elif "INFO" in line:
infos.append(line)

return {
"error_count": len(errors),
"error_count": len(erreurs),
"warning_count": len(warnings),
"info_count": len(infos),
"errors": errors,
"errors": erreurs,
"warnings": warnings
}

Expand Down
Loading