diff -uNrp zabbix-2.0.8.orig/include/log.h zabbix-2.0.8/include/log.h
--- zabbix-2.0.8.orig/include/log.h	2013-09-20 07:14:54.783600687 +0900
+++ zabbix-2.0.8/include/log.h	2013-09-20 07:15:44.685104056 +0900
@@ -26,6 +26,7 @@
 #define LOG_LEVEL_WARNING	3
 #define LOG_LEVEL_DEBUG		4
 
+#define LOG_LEVEL_ROTATE	126
 #define LOG_LEVEL_INFORMATION	127	/* printing in any case no matter what level set */
 
 #define LOG_TYPE_UNDEFINED	0
diff -uNrp zabbix-2.0.8.orig/src/libs/zbxlog/log.c zabbix-2.0.8/src/libs/zbxlog/log.c
--- zabbix-2.0.8.orig/src/libs/zbxlog/log.c	2013-09-20 07:14:54.783600687 +0900
+++ zabbix-2.0.8/src/libs/zbxlog/log.c	2013-09-20 07:19:41.343490295 +0900
@@ -209,6 +209,13 @@ void __zbx_zabbix_log(int level, const c
 	struct timeval		current_time;
 #endif
 
+	if (LOG_LEVEL_ROTATE == level)
+	{
+		if (LOG_TYPE_FILE == log_type)
+			redirect_std(log_filename);
+		return;
+	}
+
 	if (LOG_LEVEL_INFORMATION != level && (level > log_level || LOG_LEVEL_EMPTY == level))
 		return;
 
diff -uNrp zabbix-2.0.8.orig/src/zabbix_server/alerter/alerter.c zabbix-2.0.8/src/zabbix_server/alerter/alerter.c
--- zabbix-2.0.8.orig/src/zabbix_server/alerter/alerter.c	2013-09-20 07:14:54.784600698 +0900
+++ zabbix-2.0.8/src/zabbix_server/alerter/alerter.c	2013-09-20 07:15:44.687104076 +0900
@@ -58,6 +58,8 @@ int	execute_action(DB_ALERT *alert, DB_M
 	zabbix_log(LOG_LEVEL_DEBUG, "In %s(): alertid [" ZBX_FS_UI64 "] mediatype [%d]",
 			__function_name, alert->alertid, mediatype->type);
 
+	zabbix_log(LOG_LEVEL_ROTATE, "");
+
 	if (MEDIA_TYPE_EMAIL == mediatype->type)
 	{
 		alarm(ALARM_ACTION_TIMEOUT);
diff -uNrp zabbix-2.0.8.orig/src/zabbix_server/discoverer/discoverer.c zabbix-2.0.8/src/zabbix_server/discoverer/discoverer.c
--- zabbix-2.0.8.orig/src/zabbix_server/discoverer/discoverer.c	2013-08-21 22:59:21.000000000 +0900
+++ zabbix-2.0.8/src/zabbix_server/discoverer/discoverer.c	2013-09-20 07:24:02.314167782 +0900
@@ -258,6 +258,7 @@ static int	discover_service(DB_DCHECK *d
 								&item.snmpv3_privpassphrase, MACRO_TYPE_ITEM_FIELD, NULL, 0);
 					}
 
+					zabbix_log(LOG_LEVEL_ROTATE, "");
 					if (SUCCEED == get_value_snmp(&item, &result) && NULL != GET_STR_RESULT(&result))
 						zbx_strlcpy(value, result.str, DSERVICE_VALUE_LEN_MAX);
 					else
diff -uNrp zabbix-2.0.8.orig/src/zabbix_server/poller/poller.c zabbix-2.0.8/src/zabbix_server/poller/poller.c
--- zabbix-2.0.8.orig/src/zabbix_server/poller/poller.c	2013-09-20 07:14:54.785600709 +0900
+++ zabbix-2.0.8/src/zabbix_server/poller/poller.c	2013-09-20 07:15:44.687104076 +0900
@@ -464,6 +464,7 @@ static int	get_value(DC_ITEM *item, AGEN
 
 	zabbix_log(LOG_LEVEL_DEBUG, "In %s() key:'%s'", __function_name, item->key_orig);
 
+	zabbix_log(LOG_LEVEL_ROTATE, "");
 	switch (item->type)
 	{
 		case ITEM_TYPE_ZABBIX:
--- zabbix-2.0.10-1/src/libs/zbxlog/log.c.bk	2014-03-18 11:26:49.769104145 +0900
+++ zabbix-2.0.10-1/src/libs/zbxlog/log.c	2014-03-18 11:35:17.353900794 +0900
@@ -45,6 +45,8 @@ void	redirect_std(const char *filename)
 	const char	default_file[] = "/dev/null";
 	const char	*out_file = default_file;
 	int		open_flags = O_WRONLY;
+	int		count = 0;
+	struct timespec ts = {0, 100000000L};
 
 	close(STDIN_FILENO);
 	open(default_file, O_RDONLY);	/* stdin, normally fd==0 */
@@ -55,6 +57,7 @@ void	redirect_std(const char *filename)
 		open_flags |= O_CREAT | O_APPEND;
 	}
 
+retry:
 	if (-1 != (fd = open(out_file, open_flags, 0666)))
 	{
 		if (-1 == dup2(fd, STDERR_FILENO))
@@ -67,6 +70,12 @@ void	redirect_std(const char *filename)
 	}
 	else
 	{
+		if (count++ == 3) return;
+		else
+		{
+			nanosleep(&ts, NULL);
+			goto retry;
+		}
 		zbx_error("cannot open [%s]: %s", filename, zbx_strerror(errno));
 		exit(FAIL);
 	}
diff -uNrp zabbix-2.2.3.orig/include/log.h zabbix-2.2.3/include/log.h
--- zabbix-2.2.3.orig/include/log.h	2014-04-07 18:03:40.000000000 +0900
+++ zabbix-2.2.3/include/log.h	2014-04-30 15:32:33.571463760 +0900
@@ -26,6 +26,7 @@
 #define LOG_LEVEL_WARNING	3
 #define LOG_LEVEL_DEBUG		4
 
+#define LOG_LEVEL_ROTATE	126
 #define LOG_LEVEL_INFORMATION	127	/* printing in any case no matter what level set */
 
 #define LOG_TYPE_UNDEFINED	0
@@ -68,10 +69,11 @@ char *strerror_from_system(unsigned long
 char *strerror_from_module(unsigned long error, LPCTSTR module);
 #endif
 
+extern int	redirect_std_result;
 #if defined(_WINDOWS)
-#	define redirect_std(filename)
+#	define redirect_std(filename) 0
 #else
-	void redirect_std(const char *filename);
+	int redirect_std(const char *filename);
 #endif
 
 #endif
diff -uNrp zabbix-2.2.3.orig/src/libs/zbxexec/execute.c zabbix-2.2.3/src/libs/zbxexec/execute.c
--- zabbix-2.2.3.orig/src/libs/zbxexec/execute.c	2014-04-07 18:03:41.000000000 +0900
+++ zabbix-2.2.3/src/libs/zbxexec/execute.c	2014-04-30 15:32:33.843196006 +0900
@@ -535,7 +535,7 @@ int	zbx_execute_nowait(const char *comma
 
 			/* suppress the output of the executed script, otherwise */
 			/* the output might get written to a logfile or elsewhere */
-			redirect_std(NULL);
+			redirect_std_result = redirect_std(NULL);
 
 			/* replace the process with actual command to be executed */
 			execl("/bin/sh", "sh", "-c", command, NULL);
diff -uNrp zabbix-2.2.3.orig/src/libs/zbxlog/log.c zabbix-2.2.3/src/libs/zbxlog/log.c
--- zabbix-2.2.3.orig/src/libs/zbxlog/log.c	2014-04-07 18:03:41.000000000 +0900
+++ zabbix-2.2.3/src/libs/zbxlog/log.c	2014-04-30 15:32:33.843196006 +0900
@@ -35,6 +35,7 @@ static int		log_level = LOG_LEVEL_DEBUG;
 #else
 static int		log_level = LOG_LEVEL_WARNING;
 #endif
+int			redirect_std_result = 0;
 
 #define ZBX_MESSAGE_BUF_SIZE	1024
 
@@ -43,12 +44,14 @@ static int		log_level = LOG_LEVEL_WARNIN
 
 
 #if !defined(_WINDOWS)
-void	redirect_std(const char *filename)
+int	redirect_std(const char *filename)
 {
 	int		fd;
 	const char	default_file[] = "/dev/null";
 	const char	*out_file = default_file;
 	int		open_flags = O_WRONLY;
+	int		count = 0;
+	struct timespec	ts = {0, 100000000L};
 
 	close(STDIN_FILENO);
 	open(default_file, O_RDONLY);	/* stdin, normally fd==0 */
@@ -59,6 +62,7 @@ void	redirect_std(const char *filename)
 		open_flags |= O_CREAT | O_APPEND;
 	}
 
+retry:
 	if (-1 != (fd = open(out_file, open_flags, 0666)))
 	{
 		if (-1 == dup2(fd, STDERR_FILENO))
@@ -68,11 +72,16 @@ void	redirect_std(const char *filename)
 			zbx_error("cannot redirect stdout to [%s]", filename);
 
 		close(fd);
+		return SUCCEED;
 	}
 	else
 	{
-		zbx_error("cannot open [%s]: %s", filename, zbx_strerror(errno));
-		exit(FAIL);
+		if (count++ < 3)
+		{
+			nanosleep(&ts, NULL);
+			goto retry;
+		}
+		return FAIL;
 	}
 }
 #endif	/* not _WINDOWS */
@@ -228,6 +237,16 @@ void __zbx_zabbix_log(int level, const c
 	struct timeval		current_time;
 #endif
 
+	if (LOG_LEVEL_ROTATE == level)
+	{
+		if (LOG_TYPE_FILE == log_type)
+			redirect_std_result = redirect_std(log_filename);
+		return;
+	}
+
+	if (FAIL == redirect_std_result && LOG_TYPE_FILE == log_type)
+		redirect_std_result = redirect_std(log_filename);
+
 	if (SUCCEED != ZBX_CHECK_LOG_LEVEL(level))
 		return;
 
@@ -294,7 +313,7 @@ void __zbx_zabbix_log(int level, const c
 			}
 
 			if (old_size > (zbx_uint64_t)buf.st_size)
-				redirect_std(log_filename);
+				redirect_std_result = redirect_std(log_filename);
 
 			old_size = (zbx_uint64_t)buf.st_size;
 		}
diff -uNrp zabbix-2.2.3.orig/src/libs/zbxnix/daemon.c zabbix-2.2.3/src/libs/zbxnix/daemon.c
--- zabbix-2.2.3.orig/src/libs/zbxnix/daemon.c	2014-04-30 15:32:00.576444277 +0900
+++ zabbix-2.2.3/src/libs/zbxnix/daemon.c	2014-04-30 15:32:33.843196006 +0900
@@ -210,7 +210,7 @@ int	daemon_start(int allow_root)
 
 	umask(0002);
 
-	redirect_std(CONFIG_LOG_FILE);
+	redirect_std_result = redirect_std(CONFIG_LOG_FILE);
 
 	if (FAIL == create_pid_file(CONFIG_PID_FILE))
 		exit(FAIL);
diff -uNrp zabbix-2.2.3.orig/src/zabbix_server/alerter/alerter.c zabbix-2.2.3/src/zabbix_server/alerter/alerter.c
--- zabbix-2.2.3.orig/src/zabbix_server/alerter/alerter.c	2014-04-07 18:03:41.000000000 +0900
+++ zabbix-2.2.3/src/zabbix_server/alerter/alerter.c	2014-04-30 15:35:54.215220443 +0900
@@ -58,6 +58,8 @@ int	execute_action(DB_ALERT *alert, DB_M
 	zabbix_log(LOG_LEVEL_DEBUG, "In %s(): alertid [" ZBX_FS_UI64 "] mediatype [%d]",
 			__function_name, alert->alertid, mediatype->type);
 
+	zabbix_log(LOG_LEVEL_ROTATE, "");
+
 	if (MEDIA_TYPE_EMAIL == mediatype->type)
 	{
 		alarm(ALARM_ACTION_TIMEOUT);
diff -uNrp zabbix-2.2.3.orig/src/zabbix_server/discoverer/discoverer.c zabbix-2.2.3/src/zabbix_server/discoverer/discoverer.c
--- zabbix-2.2.3.orig/src/zabbix_server/discoverer/discoverer.c	2014-04-07 18:03:41.000000000 +0900
+++ zabbix-2.2.3/src/zabbix_server/discoverer/discoverer.c	2014-04-30 15:35:01.963217877 +0900
@@ -266,6 +266,7 @@ static int	discover_service(DB_DCHECK *d
 								&item.snmpv3_contextname, MACRO_TYPE_COMMON, NULL, 0);
 					}
 
+					zabbix_log(LOG_LEVEL_ROTATE, "");
 					if (SUCCEED == get_value_snmp(&item, &result) && NULL != GET_STR_RESULT(&result))
 						zbx_strlcpy(value, result.str, DSERVICE_VALUE_LEN_MAX);
 					else
diff -uNrp zabbix-2.2.3.orig/src/zabbix_server/poller/poller.c zabbix-2.2.3/src/zabbix_server/poller/poller.c
--- zabbix-2.2.3.orig/src/zabbix_server/poller/poller.c	2014-04-07 18:03:41.000000000 +0900
+++ zabbix-2.2.3/src/zabbix_server/poller/poller.c	2014-04-30 15:36:54.479194292 +0900
@@ -420,6 +420,7 @@ static int	get_value(DC_ITEM *item, AGEN
 
 	zabbix_log(LOG_LEVEL_DEBUG, "In %s() key:'%s'", __function_name, item->key_orig);
 
+	zabbix_log(LOG_LEVEL_ROTATE, "");
 	switch (item->type)
 	{
 		case ITEM_TYPE_ZABBIX:
