saving day old log files in /var/log/apache2/rotate with compression












0















One of the production servers at my work has a /varlog/apache2 directory that looks like this:



servername.com-access.log
rotated/servername.com-access.log-20190127
rotated/servername.com-access.log-20190126.gz
rotated/servername.com-access.log-20190125.gz
...


I like this approach and want to duplicate it on a personal server but it's not clear to me how this might be done.



My personal server is just logging everything to website.com-access.log. It's not rotating the log files and using this approach the log file is liable to get very big and I just don't like it.



On the production server there's a /etc/logrotate.d/apache2 file with the following contents:



/var/log/apache2/*.log {
daily
missingok
rotate 365
compress
delaycompress
dateext
olddir rotated
notifempty
create 640 root adm
sharedscripts
postrotate
if /etc/init.d/apache2 status > /dev/null ; then
/etc/init.d/apache2 reload > /dev/null;
fi;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
}


I copied that file to my personal server and thought it'd magically start working as above but it isn't. Does logrotate need to be restarted for the changes to take effect or am I missing something?










share|improve this question























  • "Does logrotate need to be restarted for the changes to take effect or am I missing something?" -You failed to mention what your logrotation was set at, if it was weekly, then it won't be updated until the cron job runs again. You can force the logrotate to happen with the appropriate command.

    – Ramhound
    Feb 10 at 18:48
















0















One of the production servers at my work has a /varlog/apache2 directory that looks like this:



servername.com-access.log
rotated/servername.com-access.log-20190127
rotated/servername.com-access.log-20190126.gz
rotated/servername.com-access.log-20190125.gz
...


I like this approach and want to duplicate it on a personal server but it's not clear to me how this might be done.



My personal server is just logging everything to website.com-access.log. It's not rotating the log files and using this approach the log file is liable to get very big and I just don't like it.



On the production server there's a /etc/logrotate.d/apache2 file with the following contents:



/var/log/apache2/*.log {
daily
missingok
rotate 365
compress
delaycompress
dateext
olddir rotated
notifempty
create 640 root adm
sharedscripts
postrotate
if /etc/init.d/apache2 status > /dev/null ; then
/etc/init.d/apache2 reload > /dev/null;
fi;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
}


I copied that file to my personal server and thought it'd magically start working as above but it isn't. Does logrotate need to be restarted for the changes to take effect or am I missing something?










share|improve this question























  • "Does logrotate need to be restarted for the changes to take effect or am I missing something?" -You failed to mention what your logrotation was set at, if it was weekly, then it won't be updated until the cron job runs again. You can force the logrotate to happen with the appropriate command.

    – Ramhound
    Feb 10 at 18:48














0












0








0








One of the production servers at my work has a /varlog/apache2 directory that looks like this:



servername.com-access.log
rotated/servername.com-access.log-20190127
rotated/servername.com-access.log-20190126.gz
rotated/servername.com-access.log-20190125.gz
...


I like this approach and want to duplicate it on a personal server but it's not clear to me how this might be done.



My personal server is just logging everything to website.com-access.log. It's not rotating the log files and using this approach the log file is liable to get very big and I just don't like it.



On the production server there's a /etc/logrotate.d/apache2 file with the following contents:



/var/log/apache2/*.log {
daily
missingok
rotate 365
compress
delaycompress
dateext
olddir rotated
notifempty
create 640 root adm
sharedscripts
postrotate
if /etc/init.d/apache2 status > /dev/null ; then
/etc/init.d/apache2 reload > /dev/null;
fi;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
}


I copied that file to my personal server and thought it'd magically start working as above but it isn't. Does logrotate need to be restarted for the changes to take effect or am I missing something?










share|improve this question














One of the production servers at my work has a /varlog/apache2 directory that looks like this:



servername.com-access.log
rotated/servername.com-access.log-20190127
rotated/servername.com-access.log-20190126.gz
rotated/servername.com-access.log-20190125.gz
...


I like this approach and want to duplicate it on a personal server but it's not clear to me how this might be done.



My personal server is just logging everything to website.com-access.log. It's not rotating the log files and using this approach the log file is liable to get very big and I just don't like it.



On the production server there's a /etc/logrotate.d/apache2 file with the following contents:



/var/log/apache2/*.log {
daily
missingok
rotate 365
compress
delaycompress
dateext
olddir rotated
notifempty
create 640 root adm
sharedscripts
postrotate
if /etc/init.d/apache2 status > /dev/null ; then
/etc/init.d/apache2 reload > /dev/null;
fi;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
}


I copied that file to my personal server and thought it'd magically start working as above but it isn't. Does logrotate need to be restarted for the changes to take effect or am I missing something?







ubuntu logging logrotate






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 10 at 17:46









neubertneubert

1,833174688




1,833174688













  • "Does logrotate need to be restarted for the changes to take effect or am I missing something?" -You failed to mention what your logrotation was set at, if it was weekly, then it won't be updated until the cron job runs again. You can force the logrotate to happen with the appropriate command.

    – Ramhound
    Feb 10 at 18:48



















  • "Does logrotate need to be restarted for the changes to take effect or am I missing something?" -You failed to mention what your logrotation was set at, if it was weekly, then it won't be updated until the cron job runs again. You can force the logrotate to happen with the appropriate command.

    – Ramhound
    Feb 10 at 18:48

















"Does logrotate need to be restarted for the changes to take effect or am I missing something?" -You failed to mention what your logrotation was set at, if it was weekly, then it won't be updated until the cron job runs again. You can force the logrotate to happen with the appropriate command.

– Ramhound
Feb 10 at 18:48





"Does logrotate need to be restarted for the changes to take effect or am I missing something?" -You failed to mention what your logrotation was set at, if it was weekly, then it won't be updated until the cron job runs again. You can force the logrotate to happen with the appropriate command.

– Ramhound
Feb 10 at 18:48










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1404199%2fsaving-day-old-log-files-in-var-log-apache2-rotate-with-compression%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1404199%2fsaving-day-old-log-files-in-var-log-apache2-rotate-with-compression%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕