diff --git a/scripts/backup b/scripts/backup
index a1138ab..261bf40 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -50,6 +50,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
+#=================================================
+# BACKUP LOGROTATE
+#=================================================
+
+ynh_backup --src_path="/etc/logrotate.d/$app"
+
#=================================================
# BACKUP VARIOUS FILES
#=================================================
diff --git a/scripts/install b/scripts/install
index 89a0194..e405e04 100644
--- a/scripts/install
+++ b/scripts/install
@@ -128,6 +128,10 @@ ynh_replace_string --match_string="" --replace_string="$path
# Disable Setup Wizard
ynh_replace_string --match_string="false" --replace_string="true" --target_file="$config_path/system.xml"
+# Lower logging verbosity
+cp "$config_path/logging.default.json" "$config_path/logging.json"
+ynh_replace_string --match_string="\"Default\": \"Information\"" --replace_string="\"Default\": \"Error\""
+
ynh_store_file_checksum --file="$config_path/network.xml"
ynh_store_file_checksum --file="$config_path/system.xml"
@@ -150,6 +154,14 @@ ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path
+#=================================================
+# SETUP LOGROTATE
+#=================================================
+ynh_script_progression --message="Configuring log rotation..." --time --weight=1
+
+# Use logrotate to manage application logfile(s)
+ynh_use_logrotate
+
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
diff --git a/scripts/remove b/scripts/remove
index 6ec2980..7593e28 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -63,6 +63,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
+#=================================================
+# REMOVE LOGROTATE CONFIGURATION
+#=================================================
+ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1
+
+# Remove the app-specific logrotate config
+ynh_remove_logrotate
+
#=================================================
# GENERIC FINALIZATION
#=================================================
diff --git a/scripts/restore b/scripts/restore
index d461558..c4ad372 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -121,6 +121,13 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Startup complete"
+
+#=================================================
+# RESTORE THE LOGROTATE CONFIGURATION
+#=================================================
+
+ynh_restore_file --origin_path="/etc/logrotate.d/$app"
+
#=================================================
# GENERIC FINALIZATION
#=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index 3c4c2de..ab3b6a0 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -39,7 +39,7 @@ if [[ ! "$architecture" =~ ^(amd64|arm64|armhf)$ ]]; then
ynh_die "Jellyfin is not compatible with your architecture, $architecture, which is neither amd64, arm64, or armhf." 1
fi
-# If db_name doesn't exist, create it
+# If path keys do not exist, create it
if [ -z "$config_path" ]; then
config_path=/var/lib/jellyfin
ynh_app_setting_set --app=$app --key=config_path --value=$config_path
@@ -47,6 +47,13 @@ if [ -z "$config_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
+
+# If logging config does not exist, lower logging verbosity
+if ! [ -e "$config_path/logging.json" ]; then
+ cp "$config_path/logging.default.json" "$config_path/logging.json"
+ ynh_replace_string --match_string="\"Default\": \"Information\"" --replace_string="\"Default\": \"Error\""
+fi
+
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
@@ -169,6 +176,14 @@ fi
# Set permissions on app files
chown -R $app: $final_path
+#=================================================
+# SETUP LOGROTATE
+#=================================================
+ynh_script_progression --message="Configuring log rotation..." --time --weight=1
+
+# Use logrotate to manage application logfile(s)
+ynh_use_logrotate --non-append
+
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================