Skip to content

Commit d1ca42a

Browse files
authored
Refactor: Graylog (#8912)
* Refactor * Update graylog.sh * Update graylog-install.sh
1 parent 2909a57 commit d1ca42a

File tree

3 files changed

+67
-55
lines changed

3 files changed

+67
-55
lines changed

ct/graylog.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}"
1111
var_ram="${var_ram:-8192}"
1212
var_disk="${var_disk:-30}"
1313
var_os="${var_os:-debian}"
14-
var_version="${var_version:-12}"
14+
var_version="${var_version:-13}"
1515
var_unprivileged="${var_unprivileged:-1}"
1616

1717
header_info "$APP"
@@ -28,15 +28,32 @@ function update_script() {
2828
msg_error "No ${APP} Installation Found!"
2929
exit
3030
fi
31+
3132
msg_info "Stopping Service"
3233
systemctl stop graylog-datanode
3334
systemctl stop graylog-server
3435
msg_info "Stopped Service"
3536

36-
msg_info "Updating $APP"
37-
$STD apt-get update
38-
$STD apt-get upgrade -y
39-
msg_ok "Updated $APP"
37+
CURRENT_VERSION=$(apt list --installed 2>/dev/null | grep graylog-server | grep -oP '\d+\.\d+\.\d+')
38+
39+
if dpkg --compare-versions "$CURRENT_VERSION" lt "6.3"; then
40+
MONGO_VERSION="8.0" setup_mongodb
41+
42+
msg_info "Updating Graylog"
43+
$STD apt update
44+
$STD apt upgrade -y
45+
curl -fsSL "https://packages.graylog2.org/repo/packages/graylog-7.0-repository_latest.deb" -o "graylog-7.0-repository_latest.deb"
46+
$STD dpkg -i graylog-7.0-repository_latest.deb
47+
$STD apt update
48+
$STD apt install -y graylog-server graylog-datanode
49+
rm -f graylog-7.0-repository_latest.deb
50+
msg_ok "Updated Graylog"
51+
elif dpkg --compare-versions "$CURRENT_VERSION" ge "7.0"; then
52+
msg_info "Updating Graylog"
53+
$STD apt update
54+
$STD apt upgrade -y
55+
msg_ok "Updated Graylog"
56+
fi
4057

4158
msg_info "Starting Service"
4259
systemctl start graylog-datanode

frontend/public/json/graylog.json

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
{
2-
"name": "Graylog",
3-
"slug": "graylog",
4-
"categories": [
5-
9
6-
],
7-
"date_created": "2025-02-12",
8-
"type": "ct",
9-
"updateable": true,
10-
"privileged": false,
11-
"interface_port": 9000,
12-
"documentation": "https://go2docs.graylog.org/current/home.htm",
13-
"website": "https://graylog.org/",
14-
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/graylog.webp",
15-
"config_path": "/etc/graylog/server/server.conf",
16-
"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.",
17-
"install_methods": [
18-
{
19-
"type": "default",
20-
"script": "ct/graylog.sh",
21-
"resources": {
22-
"cpu": 2,
23-
"ram": 8192,
24-
"hdd": 30,
25-
"os": "debian",
26-
"version": "12"
27-
}
28-
}
29-
],
30-
"default_credentials": {
31-
"username": null,
32-
"password": null
2+
"name": "Graylog",
3+
"slug": "graylog",
4+
"categories": [
5+
9
6+
],
7+
"date_created": "2025-02-12",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 9000,
12+
"documentation": "https://go2docs.graylog.org/current/home.htm",
13+
"website": "https://graylog.org/",
14+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/graylog.webp",
15+
"config_path": "/etc/graylog/server/server.conf",
16+
"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.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/graylog.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 8192,
24+
"hdd": 30,
25+
"os": "debian",
26+
"version": "13"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": [
35+
{
36+
"text": "Initial Setup credentials: `tail /var/log/graylog-server/server.log` after the server starts for the first time.",
37+
"type": "info"
3338
},
34-
"notes": [
35-
{
36-
"text": "Initial Setup credentials: `tail /var/log/graylog-server/server.log` after the server starts for the first time.",
37-
"type": "info"
38-
},
39-
{
40-
"text": "Type `cat ~/graylog.creds` to get admin password that you use to log in AFTER the Initial Setup",
41-
"type": "info"
42-
}
43-
]
39+
{
40+
"text": "Type `cat ~/graylog.creds` to get admin password that you use to log in AFTER the Initial Setup",
41+
"type": "info"
42+
}
43+
]
4444
}

install/graylog-install.sh

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ setting_up_container
1313
network_check
1414
update_os
1515

16-
MONGO_VERSION="7.0" setup_mongodb
16+
MONGO_VERSION="8.0" setup_mongodb
1717

1818
msg_info "Setup Graylog Data Node"
1919
PASSWORD_SECRET=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c16)
20-
curl -fsSL "https://packages.graylog2.org/repo/packages/graylog-6.3-repository_latest.deb" -o "graylog-6.3-repository_latest.deb"
21-
$STD dpkg -i graylog-6.3-repository_latest.deb
20+
curl -fsSL "https://packages.graylog2.org/repo/packages/graylog-7.0-repository_latest.deb" -o "graylog-7.0-repository_latest.deb"
21+
$STD dpkg -i graylog-7.0-repository_latest.deb
2222
$STD apt-get update
2323
$STD apt-get install graylog-datanode -y
2424
sed -i "s/password_secret =/password_secret = $PASSWORD_SECRET/g" /etc/graylog/datanode/datanode.conf
@@ -42,9 +42,4 @@ msg_ok "Setup ${APPLICATION}"
4242

4343
motd_ssh
4444
customize
45-
46-
msg_info "Cleaning up"
47-
rm -f graylog-*-repository_latest.deb
48-
$STD apt-get -y autoremove
49-
$STD apt-get -y autoclean
50-
msg_ok "Cleaned"
45+
cleanup_lxc

0 commit comments

Comments
 (0)