Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dirk Dankhoff
ISPConfig 3
Commits
3e0034c1
Commit
3e0034c1
authored
Jun 29, 2010
by
tbrehm
Browse files
Implemented: FS#1109 - Rotate website error logs and ispconfig log
parent
2a704f6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/conf/vhost.conf.master
View file @
3e0034c1
...
...
@@ -23,6 +23,7 @@
ServerAdmin webmaster@<tmpl_var name='domain'>
ErrorLog /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log
<tmpl_if name='errordocs'>
ErrorDocument 400 /error/400.html
...
...
server/cron_daily.php
View file @
3e0034c1
...
...
@@ -207,6 +207,13 @@ foreach($records as $rec) {
exec
(
"gzip -c
$logfile
>
$logfile
.gz"
);
unlink
(
$logfile
);
}
// rotate and compress the error.log when it exceeds a size of 10 MB
$logfile
=
escapeshellcmd
(
$rec
[
"document_root"
]
.
'/log/error.log'
);
if
(
is_file
(
$logfile
)
&&
filesize
(
$logfile
)
>
10000000
)
{
exec
(
"gzip -c
$logfile
>
$logfile
.1.gz"
);
exec
(
"cat /dev/null >
$logfile
"
);
}
// delete logfiles after 30 days
$month_ago
=
date
(
"Ymd"
,
time
()
-
86400
*
30
);
...
...
@@ -216,6 +223,17 @@ foreach($records as $rec) {
}
}
#######################################################################################################
// Rotate the ispconfig.log file
#######################################################################################################
// rotate the ispconfig.log when it exceeds a size of 10 MB
$logfile
=
'/var/log/ispconfig/ispconfig.log'
);
if
(
is_file
(
$logfile
)
&&
filesize
(
$logfile
)
>
10000000
)
{
exec
(
"gzip -c
$logfile
>
$logfile
.1.gz"
);
exec
(
"cat /dev/null >
$logfile
"
);
}
#######################################################################################################
// Cleanup website tmp directories
#######################################################################################################
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment