1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/netdata_ynh.git synced 2024-09-03 19:46:33 +02:00

Migrate to Go web server logs collector

This commit is contained in:
Jimmy Monin 2022-07-04 09:09:32 +02:00
parent 5888151d94
commit 5dff9b52b5

View file

@ -57,23 +57,27 @@ configure_netdata() {
# Add a web_log entry for every YunoHost domain # Add a web_log entry for every YunoHost domain
netdata_add_yunohost_web_logs () { netdata_add_yunohost_web_logs () {
local web_log_file="$final_path/etc/netdata/python.d/web_log.conf" local web_log_file="$final_path/etc/netdata/go.d/web_log.conf"
if [ ! -f $web_log_file ] ; then if [ ! -f $web_log_file ] ; then
cp $final_path/etc/netdata/orig/python.d/web_log.conf $web_log_file cp $final_path/etc/netdata/orig/go.d/web_log.conf $web_log_file
fi fi
if [ -z "$(grep "YUNOHOST" $web_log_file)" ] ; then if [ -z "$(grep "YUNOHOST" $web_log_file)" ] ; then
echo "# ------------YUNOHOST DOMAINS---------------" >> $web_log_file echo "# ------------YUNOHOST DOMAINS---------------" >> $web_log_file
for domain in $(yunohost domain list --output-as plain); do for domain in $(yunohost domain list --output-as plain); do
domain_label=${domain//\./_} # Replace "." by "_" for the domain label domain_label=${domain//\./_} # Replace "." by "_" for the domain label
cat >> $web_log_file <<EOF cat >> $web_log_file <<EOF
${domain_label}_log: - ${domain_label}_log:
name: '${domain_label}' name: '${domain_label}'
path: '/var/log/nginx/$domain-access.log' path: '/var/log/nginx/$domain-access.log'
EOF EOF
done done
fi fi
chgrp netdata $web_log_file chgrp netdata $web_log_file
# Manage upgrade case from python to go plugin
if [ -f "$final_path/etc/netdata/python.d/web_log.conf" ] ; then
ynh_secure_remove --file="$final_path/etc/netdata/python.d/web_log.conf"
fi
} }
# If PostgreSQL is installed, add a PostgreSQL entry using instance password # If PostgreSQL is installed, add a PostgreSQL entry using instance password