Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ISPConfig 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Helmo
ISPConfig 3
Commits
e265dcb4
Commit
e265dcb4
authored
16 years ago
by
vogelor
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a bug in the jobqueue - viewer
Fixed a bug in deleting old record from the syslog and the sys_datalog
parent
5c497021
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
interface/web/monitor/datalog_list.php
+1
-1
1 addition, 1 deletion
interface/web/monitor/datalog_list.php
server/cron_daily.php
+37
-10
37 additions, 10 deletions
server/cron_daily.php
with
38 additions
and
11 deletions
interface/web/monitor/datalog_list.php
+
1
−
1
View file @
e265dcb4
...
...
@@ -50,7 +50,7 @@ $servers = $app->db->queryAllRecords("SELECT server_id, updated FROM server");
$sql
=
'('
;
foreach
(
$servers
as
$s
)
{
$sql
.
=
" (datalog_id > "
.
$s
[
'updated'
]
.
" AND server_id = "
.
$s
[
'server_id'
]
.
")
AND
"
;
$sql
.
=
" (datalog_id > "
.
$s
[
'updated'
]
.
" AND server_id = "
.
$s
[
'server_id'
]
.
")
OR
"
;
}
$sql
=
substr
(
$sql
,
0
,
-
4
);
$sql
.
=
')'
;
...
...
This diff is collapsed.
Click to expand it.
server/cron_daily.php
+
37
−
10
View file @
e265dcb4
...
...
@@ -126,18 +126,45 @@ foreach($records as $rec) {
}
#######################################################################################################
// Cleanup logs in database
// Cleanup logs in
master
database
(only the "master-server")
#######################################################################################################
//* Keep 7 days in sys_log
$tstamp
=
time
()
-
(
60
*
60
*
24
*
7
);
$sql
=
"DELETE FROM sys_log WHERE tstamp <
$tstamp
AND server_id != 0"
;
$app
->
db
->
query
(
$sql
);
//* Keep 7 days in sys_datalog
$tstamp
=
time
()
-
(
60
*
60
*
24
*
7
);
$sql
=
"DELETE FROM sys_datalog WHERE tstamp <
$tstamp
AND server_id != 0"
;
$app
->
db
->
query
(
$sql
);
if
(
$app
->
dbmaster
==
$app
->
db
)
{
/** 7 days */
$tstamp
=
time
()
-
(
60
*
60
*
24
*
7
);
/*
* Keep 7 days in sys_log
* (we can delete the old items, because if they are OK, they don't interrest anymore
* if they are NOT ok, the server will try to process them in 1 minute and so the
* error appears again after 1 minute. So it is no problem to delete the old one!
*/
$sql
=
"DELETE FROM sys_log WHERE tstamp <
$tstamp
AND server_id != 0"
;
$app
->
dbmaster
->
query
(
$sql
);
/*
* The sys_datalog is more difficult.
* 1) We have to keet ALL entries with
* server_id=0, because they depend on ALL servers (even if they are not
* actually in the system (and will be insered in 3 days or so).
* 2) We have to keey ALL entries which are not actually precessed by the
* server never mind how old they are!
*/
/* First we need all servers and the last sys_datalog-id they processed */
$sql
=
"SELECT server_id, updated FROM server ORDER BY server_id"
;
$records
=
$app
->
dbmaster
->
queryAllRecords
(
$sql
);
/* Then delete server by server */
foreach
(
$records
as
$server
)
{
$sql
=
"DELETE FROM sys_datalog WHERE tstamp < "
.
$tstamp
.
" AND server_id != 0 "
.
// to be more secure!
" AND server_id = "
.
intval
(
$server
[
'server_id'
])
.
" AND datalog_id < "
.
intval
(
$server
[
'updated'
]);
// echo $sql . "\n";
$app
->
dbmaster
->
query
(
$sql
);
}
}
die
(
"finished.
\n
"
);
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment