From d1ca42a403e217a96eaa00760c72da96a010c14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:42:35 +0100 Subject: [PATCH] Refactor: Graylog (#8912) * Refactor * Update graylog.sh * Update graylog-install.sh --- ct/graylog.sh | 27 ++++++++-- frontend/public/json/graylog.json | 82 +++++++++++++++---------------- install/graylog-install.sh | 13 ++--- 3 files changed, 67 insertions(+), 55 deletions(-) diff --git a/ct/graylog.sh b/ct/graylog.sh index 1ed618e8f..c1a750dd9 100644 --- a/ct/graylog.sh +++ b/ct/graylog.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-8192}" var_disk="${var_disk:-30}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -28,15 +28,32 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + msg_info "Stopping Service" systemctl stop graylog-datanode systemctl stop graylog-server msg_info "Stopped Service" - msg_info "Updating $APP" - $STD apt-get update - $STD apt-get upgrade -y - msg_ok "Updated $APP" + CURRENT_VERSION=$(apt list --installed 2>/dev/null | grep graylog-server | grep -oP '\d+\.\d+\.\d+') + + if dpkg --compare-versions "$CURRENT_VERSION" lt "6.3"; then + MONGO_VERSION="8.0" setup_mongodb + + msg_info "Updating Graylog" + $STD apt update + $STD apt upgrade -y + curl -fsSL "https://packages.graylog2.org/repo/packages/graylog-7.0-repository_latest.deb" -o "graylog-7.0-repository_latest.deb" + $STD dpkg -i graylog-7.0-repository_latest.deb + $STD apt update + $STD apt install -y graylog-server graylog-datanode + rm -f graylog-7.0-repository_latest.deb + msg_ok "Updated Graylog" + elif dpkg --compare-versions "$CURRENT_VERSION" ge "7.0"; then + msg_info "Updating Graylog" + $STD apt update + $STD apt upgrade -y + msg_ok "Updated Graylog" + fi msg_info "Starting Service" systemctl start graylog-datanode diff --git a/frontend/public/json/graylog.json b/frontend/public/json/graylog.json index a0c931fce..2588242a4 100644 --- a/frontend/public/json/graylog.json +++ b/frontend/public/json/graylog.json @@ -1,44 +1,44 @@ { - "name": "Graylog", - "slug": "graylog", - "categories": [ - 9 - ], - "date_created": "2025-02-12", - "type": "ct", - "updateable": true, - "privileged": false, - "interface_port": 9000, - "documentation": "https://go2docs.graylog.org/current/home.htm", - "website": "https://graylog.org/", - "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/graylog.webp", - "config_path": "/etc/graylog/server/server.conf", - "description": "Graylog is an open-source log management and analysis platform that centralizes and processes log data from various sources, enabling real-time search, analysis, and alerting for IT infrastructure monitoring and troubleshooting.", - "install_methods": [ - { - "type": "default", - "script": "ct/graylog.sh", - "resources": { - "cpu": 2, - "ram": 8192, - "hdd": 30, - "os": "debian", - "version": "12" - } - } - ], - "default_credentials": { - "username": null, - "password": null + "name": "Graylog", + "slug": "graylog", + "categories": [ + 9 + ], + "date_created": "2025-02-12", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 9000, + "documentation": "https://go2docs.graylog.org/current/home.htm", + "website": "https://graylog.org/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/graylog.webp", + "config_path": "/etc/graylog/server/server.conf", + "description": "Graylog is an open-source log management and analysis platform that centralizes and processes log data from various sources, enabling real-time search, analysis, and alerting for IT infrastructure monitoring and troubleshooting.", + "install_methods": [ + { + "type": "default", + "script": "ct/graylog.sh", + "resources": { + "cpu": 2, + "ram": 8192, + "hdd": 30, + "os": "debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Initial Setup credentials: `tail /var/log/graylog-server/server.log` after the server starts for the first time.", + "type": "info" }, - "notes": [ - { - "text": "Initial Setup credentials: `tail /var/log/graylog-server/server.log` after the server starts for the first time.", - "type": "info" - }, - { - "text": "Type `cat ~/graylog.creds` to get admin password that you use to log in AFTER the Initial Setup", - "type": "info" - } - ] + { + "text": "Type `cat ~/graylog.creds` to get admin password that you use to log in AFTER the Initial Setup", + "type": "info" + } + ] } diff --git a/install/graylog-install.sh b/install/graylog-install.sh index 397d8ebab..1f1004210 100644 --- a/install/graylog-install.sh +++ b/install/graylog-install.sh @@ -13,12 +13,12 @@ setting_up_container network_check update_os -MONGO_VERSION="7.0" setup_mongodb +MONGO_VERSION="8.0" setup_mongodb msg_info "Setup Graylog Data Node" PASSWORD_SECRET=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c16) -curl -fsSL "https://packages.graylog2.org/repo/packages/graylog-6.3-repository_latest.deb" -o "graylog-6.3-repository_latest.deb" -$STD dpkg -i graylog-6.3-repository_latest.deb +curl -fsSL "https://packages.graylog2.org/repo/packages/graylog-7.0-repository_latest.deb" -o "graylog-7.0-repository_latest.deb" +$STD dpkg -i graylog-7.0-repository_latest.deb $STD apt-get update $STD apt-get install graylog-datanode -y sed -i "s/password_secret =/password_secret = $PASSWORD_SECRET/g" /etc/graylog/datanode/datanode.conf @@ -42,9 +42,4 @@ msg_ok "Setup ${APPLICATION}" motd_ssh customize - -msg_info "Cleaning up" -rm -f graylog-*-repository_latest.deb -$STD apt-get -y autoremove -$STD apt-get -y autoclean -msg_ok "Cleaned" +cleanup_lxc