Skip to content

Commit 067c962

Browse files
tremor021michelroegl-brunnerbvdberg01
authored
New Script: Graylog (#2270)
* add graylog script * Update install/graylog-install.sh Co-authored-by: Michel Roegl-Brunner <[email protected]> * fixes * Update ct/graylog.sh Co-authored-by: bvdberg01 <[email protected]> * used wildcard to remove repo deb * fixes v2 --------- Co-authored-by: Michel Roegl-Brunner <[email protected]> Co-authored-by: bvdberg01 <[email protected]>
1 parent e5c6953 commit 067c962

File tree

3 files changed

+167
-0
lines changed

3 files changed

+167
-0
lines changed

ct/graylog.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://graylog.org/
7+
8+
APP="Graylog"
9+
TAGS="logging"
10+
var_cpu="2"
11+
var_ram="8192"
12+
var_disk="30"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
base_settings
19+
20+
variables
21+
color
22+
catch_errors
23+
24+
function update_script() {
25+
header_info
26+
check_container_storage
27+
check_container_resources
28+
29+
if [[ ! -d /etc/graylog ]]; then
30+
msg_error "No ${APP} Installation Found!"
31+
exit
32+
fi
33+
msg_info "Stopping $APP"
34+
systemctl stop graylog-datanode
35+
systemctl stop graylog-server
36+
msg_ok "Stopped $APP"
37+
38+
msg_info "Updating $APP"
39+
apt-get update &> /dev/null
40+
apt-get upgrade -y &> /dev/null
41+
msg_ok "Updated $APP"
42+
43+
msg_info "Starting $APP"
44+
systemctl start graylog-datanode
45+
systemctl start graylog-server
46+
msg_ok "Started $APP"
47+
48+
msg_ok "Update Successful"
49+
exit
50+
}
51+
52+
start
53+
build_container
54+
description
55+
56+
msg_ok "Completed Successfully!\n"
57+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
58+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
59+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9000${CL}"

install/graylog-install.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://graylog.org/
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
curl \
19+
sudo \
20+
mc \
21+
gnupg
22+
msg_ok "Installed Dependencies"
23+
24+
msg_info "Setup MongoDB"
25+
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
26+
echo "deb [signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" >/etc/apt/sources.list.d/mongodb-org-7.0.list
27+
$STD apt-get update
28+
$STD apt-get install -y mongodb-org
29+
$STD apt-mark hold mongodb-org
30+
systemctl enable -q --now mongod
31+
msg_ok "Setup MongoDB"
32+
33+
msg_info "Setup Graylog Data Node"
34+
PASSWORD_SECRET=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c16)
35+
wget -q https://packages.graylog2.org/repo/packages/graylog-6.1-repository_latest.deb
36+
$STD dpkg -i graylog-6.1-repository_latest.deb
37+
$STD apt-get update
38+
$STD apt-get install graylog-datanode -y
39+
sed -i "s/password_secret =/password_secret = $PASSWORD_SECRET/g" /etc/graylog/datanode/datanode.conf
40+
systemctl enable -q --now graylog-datanode
41+
msg_ok "Setup Graylog Data Node"
42+
43+
msg_info "Setup ${APPLICATION}"
44+
$STD apt-get install graylog-server
45+
ROOT_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c16)
46+
{
47+
echo "${APPLICATION} Credentials"
48+
echo "Admin User: admin"
49+
echo "Admin Password: ${ROOT_PASSWORD}"
50+
} >> ~/graylog.creds
51+
ROOT_PASSWORD=$(echo -n $ROOT_PASSWORD | shasum -a 256 | awk '{print $1}')
52+
sed -i "s/password_secret =/password_secret = $PASSWORD_SECRET/g" /etc/graylog/server/server.conf
53+
sed -i "s/root_password_sha2 =/root_password_sha2 = $ROOT_PASSWORD/g" /etc/graylog/server/server.conf
54+
sed -i 's/#http_bind_address = 127.0.0.1.*/http_bind_address = 0.0.0.0:9000/g' /etc/graylog/server/server.conf
55+
systemctl enable -q --now graylog-server
56+
msg_ok "Setup ${APPLICATION}"
57+
58+
motd_ssh
59+
customize
60+
61+
msg_info "Cleaning up"
62+
rm -f graylog-*-repository_latest.deb
63+
$STD apt-get -y autoremove
64+
$STD apt-get -y autoclean
65+
msg_ok "Cleaned"

json/graylog.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
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://graylog.org/wp-content/uploads/2023/11/gl-logo-horiz-all-white-1200w-300x96.png.webp",
15+
"description": "Graylog is a free and open log management platform.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/graylog.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 8192,
23+
"hdd": 30,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": [
34+
{
35+
"text": "Initial Setup credentials: `tail /var/log/graylog-server/server.log` after the server starts for the first time.",
36+
"type": "info"
37+
},
38+
{
39+
"text": "Type `cat ~/graylog.creds` to get admin password that you use to log in AFTER the Initial Setup",
40+
"type": "info"
41+
}
42+
]
43+
}

0 commit comments

Comments
 (0)