summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-05-26 07:09:19 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-05-26 07:09:19 +0000
commit4fa107987284a8dd1d2275a4e12bbfe0570d431b (patch)
tree355a58f2dad50a46710f89334f3ef9917763bc87 /src
parent14c11a19644012a0d9ba25b4654b66a31d5bf02d (diff)
Housekeeping for history_log.
git-svn-id: svn://svn.zabbix.com/trunk@1783 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_server/housekeeper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/zabbix_server/housekeeper.c b/src/zabbix_server/housekeeper.c
index 20cf905a..ceded21c 100644
--- a/src/zabbix_server/housekeeper.c
+++ b/src/zabbix_server/housekeeper.c
@@ -168,6 +168,18 @@ int housekeeping_history_and_trends(int now)
DBexecute(sql);
#endif
+/* Delete HISTORY_LOG */
+#ifdef HAVE_MYSQL
+ snprintf(sql,sizeof(sql)-1,"delete from history_log where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
+#else
+ snprintf(sql,sizeof(sql)-1,"delete from history_log where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
+#endif
+#ifdef ZABBIX_THREADS
+ DBexecute_thread(database, sql);
+#else
+ DBexecute(sql);
+#endif
+
/* Delete HISTORY_TRENDS */
#ifdef HAVE_MYSQL
snprintf(sql,sizeof(sql)-1,"delete from trends where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.trends,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);