--- zabbix-4.0.10-1/src/libs/zbxlog/log.c	2019-07-05 07:34:02.859133708 +0900
+++ zabbix-4.0.10/src/libs/zbxlog/log.c	2019-08-19 10:45:33.095494741 +0900
@@ -245,6 +245,7 @@ static void	lock_log(void)
 	sigset_t	mask;
 
 	sigemptyset(&mask);
+	sigaddset(&mask, SIGHUP);
 	sigaddset(&mask, SIGUSR1);
 	sigaddset(&mask, SIGTERM);	/* block SIGTERM, SIGINT to prevent deadlock on log file mutex */
 	sigaddset(&mask, SIGINT);
@@ -280,6 +281,15 @@ static void	unlock_log(void)
 }
 #endif
 
+void zbx_handle_log2(void)
+{
+	LOCK_LOG;
+
+	zbx_redirect_stdio(log_filename);
+
+	UNLOCK_LOG;
+}
+
 void	zbx_handle_log(void)
 {
 	if (LOG_TYPE_FILE != log_type)
--- zabbix-4.0.10-1/src/libs/zbxnix/daemon.c	2019-07-05 07:34:02.880133851 +0900
+++ zabbix-4.0.10/src/libs/zbxnix/daemon.c	2019-08-19 11:11:59.091353712 +0900
@@ -120,6 +120,12 @@ static void	common_sigusr_handler(int fl
 	}
 }
 
+static void	common_sighup_handler(void)
+{
+	zbx_handle_log2();
+	return;
+}
+
 static void	zbx_signal_process_by_type(int proc_type, int proc_num, int flags)
 {
 	int		process_num, found = 0, i;
@@ -305,6 +311,38 @@ static void	pipe_signal_handler(int sig,
 			SIG_CHECKED_FIELD(siginfo, si_pid));
 }
 
+static void	hup_signal_handler(int sig, siginfo_t *siginfo, void *context)
+{
+	int	i;
+
+	SIG_CHECK_PARAMS(sig, siginfo, context);
+
+	zabbix_log(LOG_LEVEL_DEBUG, "Got signal [signal:%d(%s),sender_pid:%d].",
+			sig, get_signal_name(sig),
+			SIG_CHECKED_FIELD(siginfo, si_pid));
+
+	if (!SIG_PARENT_PROCESS)
+	{
+		common_sighup_handler();
+		return;
+	}
+
+	if (NULL == threads)
+	{
+		zabbix_log(LOG_LEVEL_ERR, "cannot redirect signal: shutdown in progress");
+		return;
+	}
+
+	for (i = 0; i < threads_num; i++)
+	{
+		if (threads[i])
+			kill(threads[i], SIGHUP);
+	}
+
+	zbx_handle_log2();
+	return;
+}
+
 /******************************************************************************
  *                                                                            *
  * Function: set_daemon_signal_handlers                                       *
@@ -326,6 +364,9 @@ static void	set_daemon_signal_handlers(v
 
 	phan.sa_sigaction = pipe_signal_handler;
 	sigaction(SIGPIPE, &phan, NULL);
+
+	phan.sa_sigaction = hup_signal_handler;
+	sigaction(SIGHUP, &phan, NULL);
 }
 
 /******************************************************************************
@@ -411,7 +452,7 @@ int	daemon_start(int allow_root, const c
 
 		setsid();
 
-		signal(SIGHUP, SIG_IGN);
+		//signal(SIGHUP, SIG_IGN);
 
 		wait_pid = getpid();
 		if (0 != (pid = zbx_fork()))
--- zabbix-4.0.10-1/include/log.h	2019-07-05 07:34:02.859133708 +0900
+++ zabbix-4.0.10/include/log.h	2019-08-19 10:41:58.652309250 +0900
@@ -95,6 +95,7 @@ char		*strerror_from_module(unsigned lon
 void		zbx_redirect_stdio(const char *filename);
 
 void		zbx_handle_log(void);
+void		zbx_handle_log2(void);
 
 int		zbx_get_log_type(const char *logtype);
 int		zbx_validate_log_parameters(ZBX_TASK_EX *task);
