diff --git a/centre_observabilite/loki-chunks/ZmFrZS83MjFmMGJkNmExMDA3Yzc4OjE5YjM2NDhkODgwOjE5YjM2NDhkOTdiOjM2MmUzNmUx b/centre_observabilite/loki-chunks/ZmFrZS83MjFmMGJkNmExMDA3Yzc4OjE5YjM2NDhkODgwOjE5YjM2NDhkOTdiOjM2MmUzNmUx new file mode 100644 index 0000000..243d42f Binary files /dev/null and b/centre_observabilite/loki-chunks/ZmFrZS83MjFmMGJkNmExMDA3Yzc4OjE5YjM2NDhkODgwOjE5YjM2NDhkOTdiOjM2MmUzNmUx differ diff --git a/centre_observabilite/loki-chunks/index/index_20441/71fb7324933a-1766058957788749433-1766140200.gz b/centre_observabilite/loki-chunks/index/index_20441/71fb7324933a-1766058957788749433-1766140200.gz deleted file mode 100644 index 7e5027e..0000000 Binary files a/centre_observabilite/loki-chunks/index/index_20441/71fb7324933a-1766058957788749433-1766140200.gz and /dev/null differ diff --git a/centre_observabilite/loki-chunks/index/index_20441/71fb7324933a-1766058957788749433-1766141744.gz b/centre_observabilite/loki-chunks/index/index_20441/71fb7324933a-1766058957788749433-1766141744.gz deleted file mode 100644 index b10cf6e..0000000 Binary files a/centre_observabilite/loki-chunks/index/index_20441/71fb7324933a-1766058957788749433-1766141744.gz and /dev/null differ diff --git a/centre_observabilite/loki-chunks/index/index_20441/71fb7324933a-1766058957788749433-1766142000.gz b/centre_observabilite/loki-chunks/index/index_20441/71fb7324933a-1766058957788749433-1766142000.gz new file mode 100644 index 0000000..f9735c9 Binary files /dev/null and b/centre_observabilite/loki-chunks/index/index_20441/71fb7324933a-1766058957788749433-1766142000.gz differ diff --git a/centre_observabilite/loki-chunks/index/index_20441/compactor-1766140447.gz b/centre_observabilite/loki-chunks/index/index_20441/compactor-1766140447.gz deleted file mode 100644 index 635b505..0000000 Binary files a/centre_observabilite/loki-chunks/index/index_20441/compactor-1766140447.gz and /dev/null differ diff --git a/centre_observabilite/loki-chunks/index/index_20441/compactor-1766142319.gz b/centre_observabilite/loki-chunks/index/index_20441/compactor-1766142319.gz new file mode 100644 index 0000000..7ed3853 Binary files /dev/null and b/centre_observabilite/loki-chunks/index/index_20441/compactor-1766142319.gz differ diff --git a/centre_observabilite/loki-index/index_20441/1766142000 b/centre_observabilite/loki-index/index_20441/1766142000 index 3ef928e..be353e7 100644 Binary files a/centre_observabilite/loki-index/index_20441/1766142000 and b/centre_observabilite/loki-index/index_20441/1766142000 differ diff --git a/centre_observabilite/loki-index/index_20441/1766142000.snapshot b/centre_observabilite/loki-index/index_20441/1766143019305535673.temp similarity index 86% rename from centre_observabilite/loki-index/index_20441/1766142000.snapshot rename to centre_observabilite/loki-index/index_20441/1766143019305535673.temp index 15c1295..ffb0d41 100644 Binary files a/centre_observabilite/loki-index/index_20441/1766142000.snapshot and b/centre_observabilite/loki-index/index_20441/1766143019305535673.temp differ diff --git a/centre_observabilite/loki-index/index_20441/compactor-1766140447 b/centre_observabilite/loki-index/index_20441/compactor-1766142319 similarity index 86% rename from centre_observabilite/loki-index/index_20441/compactor-1766140447 rename to centre_observabilite/loki-index/index_20441/compactor-1766142319 index 08b5673..ab2d116 100644 Binary files a/centre_observabilite/loki-index/index_20441/compactor-1766140447 and b/centre_observabilite/loki-index/index_20441/compactor-1766142319 differ diff --git a/centre_observabilite/loki-wal/00000038 b/centre_observabilite/loki-wal/00000038 deleted file mode 100644 index 16f3d24..0000000 Binary files a/centre_observabilite/loki-wal/00000038 and /dev/null differ diff --git a/centre_observabilite/loki-index/index_20441/71fb7324933a-1766058957788749433-1766140200 b/centre_observabilite/loki-wal/00000040 similarity index 70% rename from centre_observabilite/loki-index/index_20441/71fb7324933a-1766058957788749433-1766140200 rename to centre_observabilite/loki-wal/00000040 index 08fcebe..1e80568 100644 Binary files a/centre_observabilite/loki-index/index_20441/71fb7324933a-1766058957788749433-1766140200 and b/centre_observabilite/loki-wal/00000040 differ diff --git a/centre_observabilite/loki-wal/00000041 b/centre_observabilite/loki-wal/00000041 new file mode 100644 index 0000000..7811a67 Binary files /dev/null and b/centre_observabilite/loki-wal/00000041 differ diff --git a/centre_observabilite/loki-wal/checkpoint.000037/00000000 b/centre_observabilite/loki-wal/checkpoint.000037/00000000 deleted file mode 100644 index acdfdbb..0000000 Binary files a/centre_observabilite/loki-wal/checkpoint.000037/00000000 and /dev/null differ diff --git a/centre_observabilite/loki-wal/checkpoint.000039/00000000 b/centre_observabilite/loki-wal/checkpoint.000039/00000000 new file mode 100644 index 0000000..f8f3fd5 Binary files /dev/null and b/centre_observabilite/loki-wal/checkpoint.000039/00000000 differ diff --git a/centre_observabilite/loki-wal/checkpoint.000040.tmp/00000000 b/centre_observabilite/loki-wal/checkpoint.000040.tmp/00000000 new file mode 100644 index 0000000..e69de29 diff --git a/conteneur/Dockerfile b/conteneur/Dockerfile new file mode 100644 index 0000000..541fa35 --- /dev/null +++ b/conteneur/Dockerfile @@ -0,0 +1,43 @@ +FROM debian:bullseye-slim + +# Installation des dépendances +RUN apt-get update && apt-get install -y \ + apache2 \ + supervisor \ + wget \ + curl \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +# Installation Apache Exporter +RUN wget https://github.com/Lusitaniae/apache_exporter/releases/download/v1.0.10/apache_exporter-1.0.10.linux-amd64.tar.gz \ + && tar xzf apache_exporter-1.0.10.linux-amd64.tar.gz \ + && mv apache_exporter-1.0.10.linux-amd64/apache_exporter /usr/local/bin/ \ + && rm -rf apache_exporter-* + +# Installation Promtail +RUN wget https://github.com/grafana/loki/releases/download/v2.9.0/promtail-linux-amd64.zip \ + && unzip promtail-linux-amd64.zip \ + && mv promtail-linux-amd64 /usr/local/bin/promtail \ + && chmod +x /usr/local/bin/promtail \ + && rm promtail-linux-amd64.zip + +# Copie des configurations +COPY configs/apache/httpd.conf /etc/apache2/sites-available/000-default.conf +COPY configs/promtail/config.yaml /etc/promtail/config.yaml +COPY configs/supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# Configuration Apache pour server-status +RUN echo '\n\ + SetHandler server-status\n\ + Require all granted\n\ +' > /etc/apache2/conf-available/server-status.conf \ + && a2enconf server-status \ + && a2enmod status + +# Création des répertoires de logs +RUN mkdir -p /var/log/apache2 /var/log/promtail + +EXPOSE 80 9117 9080 + +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] diff --git a/conteneur/configs/apache/httpd.conf b/conteneur/configs/apache/httpd.conf new file mode 100644 index 0000000..7c987f6 --- /dev/null +++ b/conteneur/configs/apache/httpd.conf @@ -0,0 +1,27 @@ +# Configuration Apache de base +ServerRoot "/etc/apache2" +#Listen 80 + +# Modules (déjà chargés par défaut dans debian/ubuntu) + +ServerAdmin admin@localhost +ServerName localhost + +DocumentRoot "/var/www/html" + + Options Indexes FollowSymLinks + AllowOverride None + Require all granted + + +ErrorLog /var/log/apache2/error.log +LogLevel warn + +LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined +CustomLog /var/log/apache2/access.log combined + +# Server status pour apache_exporter + + SetHandler server-status + Require all granted + diff --git a/conteneur/configs/promtail/config.yaml b/conteneur/configs/promtail/config.yaml new file mode 100644 index 0000000..fcfb2a7 --- /dev/null +++ b/conteneur/configs/promtail/config.yaml @@ -0,0 +1,26 @@ +server: + http_listen_port: 9080 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +clients: + - url: http://192.168.56.61:3100/loki/api/v1/push + +scrape_configs: + - job_name: apache_access + static_configs: + - targets: [localhost] + labels: + job: apache_access + host: apache_all_in_one + __path__: /var/log/apache2/access.log + + - job_name: apache_error + static_configs: + - targets: [localhost] + labels: + job: apache_error + host: apache_all_in_one + __path__: /var/log/apache2/error.log diff --git a/conteneur/configs/supervisord/supervisord.conf b/conteneur/configs/supervisord/supervisord.conf new file mode 100644 index 0000000..9f19fc9 --- /dev/null +++ b/conteneur/configs/supervisord/supervisord.conf @@ -0,0 +1,31 @@ +[supervisord] +nodaemon=true +user=root +logfile=/var/log/supervisor/supervisord.log +pidfile=/var/run/supervisord.pid + +[program:apache2] +command=/usr/sbin/apache2ctl -D FOREGROUND +autostart=true +autorestart=true +stdout_logfile=/var/log/apache2/access.log +stderr_logfile=/var/log/apache2/error.log +priority=1 + +[program:apache_exporter] +command=/usr/local/bin/apache_exporter --scrape_uri=http://localhost/server-status?auto +autostart=true +autorestart=true +stdout_logfile=/var/log/apache_exporter.log +stderr_logfile=/var/log/apache_exporter_error.log +priority=2 +startsecs=5 + +[program:promtail] +command=/usr/local/bin/promtail -config.file=/etc/promtail/config.yaml +autostart=true +autorestart=true +stdout_logfile=/var/log/promtail/promtail.log +stderr_logfile=/var/log/promtail/promtail_error.log +priority=3 +startsecs=5 diff --git a/conteneur/docker-compose.yml b/conteneur/docker-compose.yml new file mode 100644 index 0000000..100d531 --- /dev/null +++ b/conteneur/docker-compose.yml @@ -0,0 +1,23 @@ +services: + apache-observability: + build: + context: . + dockerfile: Dockerfile + container_name: apache_all_in_one + ports: + - "8080:80" + - "9117:9117" + - "9080:9080" + volumes: + - apache-logs:/var/log/apache2 + networks: + - centre_observabilite_observability + restart: unless-stopped + +volumes: + apache-logs: + +networks: + centre_observabilite_observability: + external: true + name: centre_observabilite_observability diff --git a/conteneur/services/apache_service/docker-compose.yml b/conteneur/services/apache_service/docker-compose.yml deleted file mode 100644 index 881cbe7..0000000 --- a/conteneur/services/apache_service/docker-compose.yml +++ /dev/null @@ -1,176 +0,0 @@ -services: - apache-config-init: - image: busybox:latest - container_name: apache-config-init - volumes: - - apache-config:/config - command: - - /bin/sh - - -c - - | - cat > /config/httpd.conf <<'EOF' - ServerRoot "/usr/local/apache2" - Listen 80 - - LoadModule mpm_event_module modules/mod_mpm_event.so - LoadModule authn_file_module modules/mod_authn_file.so - LoadModule authn_core_module modules/mod_authn_core.so - LoadModule authz_host_module modules/mod_authz_host.so - LoadModule authz_groupfile_module modules/mod_authz_groupfile.so - LoadModule authz_user_module modules/mod_authz_user.so - LoadModule authz_core_module modules/mod_authz_core.so - LoadModule access_compat_module modules/mod_access_compat.so - LoadModule auth_basic_module modules/mod_auth_basic.so - LoadModule reqtimeout_module modules/mod_reqtimeout.so - LoadModule filter_module modules/mod_filter.so - LoadModule mime_module modules/mod_mime.so - LoadModule log_config_module modules/mod_log_config.so - LoadModule env_module modules/mod_env.so - LoadModule headers_module modules/mod_headers.so - LoadModule setenvif_module modules/mod_setenvif.so - LoadModule version_module modules/mod_version.so - LoadModule unixd_module modules/mod_unixd.so - LoadModule status_module modules/mod_status.so - LoadModule autoindex_module modules/mod_autoindex.so - LoadModule dir_module modules/mod_dir.so - LoadModule alias_module modules/mod_alias.so - - - User daemon - Group daemon - - - ServerAdmin admin@localhost - ServerName localhost - - - AllowOverride none - Require all denied - - - DocumentRoot "/usr/local/apache2/htdocs" - - Options Indexes FollowSymLinks - AllowOverride None - Require all granted - - - - DirectoryIndex index.html - - - - Require all denied - - - ErrorLog /usr/local/apache2/logs/error_log - LogLevel warn - - - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "%h %l %u %t \"%r\" %>s %b" common - CustomLog /usr/local/apache2/logs/access_log combined - - - - TypesConfig conf/mime.types - AddType application/x-compress .Z - AddType application/x-gzip .gz .tgz - - - # Configuration du module status pour apache_exporter - - SetHandler server-status - Require all granted - - EOF - echo "Apache config created" - restart: "no" - - apache_service: - image: httpd:2.4 - container_name: conteneur_service - ports: - - "8080:80" - volumes: - - apache-logs:/usr/local/apache2/logs - - apache-config:/usr/local/apache2/conf:ro - networks: - - observability - depends_on: - - apache-config-init - command: > - sh -c "touch /usr/local/apache2/logs/access_log /usr/local/apache2/logs/error_log && - exec httpd-foreground" - - apache_exporter: - image: lusotycoon/apache-exporter:v1.0.10 - container_name: apache_exporter_service - command: - - '--scrape_uri=http://apache_service/server-status?auto' - ports: - - "9117:9117" - depends_on: - - apache_service - networks: - - observability - - promtail-service-config-init: - image: busybox:latest - container_name: promtail-service-config-init - volumes: - - promtail-service-config-vol:/config - command: - - /bin/sh - - -c - - | - cat > /config/config.yaml <<'EOF' - server: - http_listen_port: 9080 - grpc_listen_port: 0 - positions: - filename: /tmp/positions.yaml - clients: - - url: http://192.168.56.61:3100/loki/api/v1/push - scrape_configs: - - job_name: apache_access - static_configs: - - targets: [localhost] - labels: - job: apache_access - host: conteneur_service - __path__: /var/log/apache2/access_log - - job_name: apache_error - static_configs: - - targets: [localhost] - labels: - job: apache_error - host: conteneur_service - __path__: /var/log/apache2/error_log - EOF - echo "Promtail service config created" - restart: "no" - - promtail_service: - image: grafana/promtail:2.9.0 - container_name: promtail_service - volumes: - - apache-logs:/var/log/apache2:ro - - promtail-service-config-vol:/etc/promtail:ro - command: - - '-config.file=/etc/promtail/config.yaml' - depends_on: - - promtail-service-config-init - - apache_service - networks: - - observability - -volumes: - apache-logs: - apache-config: - promtail-service-config-vol: - -networks: - observability: - external: true - name: observability_observability \ No newline at end of file