(Linux) /var/log organisation using logrotate and rsyslog without breaking important systemslogrotate does not compress /var/log/messagesHow can I log iptables in Ubuntu just in /var/log/firewall with rsyslogdLogrotate Successful, original file goes back to original sizeRSyslog does not work with a log file located outside of /var/logRemote rsyslog only writing logging data to /var/log/syslog and not custom logfilesrsyslogd template stopped workingHow can I make rsyslog send the logfiles to a location outside of /var/log?Huge /var/log directory inode in ext3 after creating and removing many filesLogrotate Not Deleting Compressed LogsHow to open multiple log files with less and logrotate?

When to remove insignificant variables?

Why does independence imply zero correlation?

What can I do with a research project that is my university’s intellectual property?

Why are < or > required to use /dev/tcp

How can you guarantee that you won't change/quit job after just couple of months?

CircuiTikZ: Start ground relative to the closest component

What's currently blocking the construction of the wall between Mexico and the US?

Concurrent normals conjecture

Is "Busen" just the area between the breasts?

Can humans ever directly see a few photons at a time? Can a human see a single photon?

What are Elsa's reasons for selecting the Holy Grail on behalf of Donovan?

Heavily limited premature compiler translates text into excecutable python code

Shooting someone's past self using special relativity

Helping ease my back pain by studying 13 hours everyday , even weekends

How many people are necessary to maintain modern civilisation?

Designing a magic-compatible polearm

Do I have any obligations to my PhD supervisor's requests after I have graduated?

Did the CIA blow up a Siberian pipeline in 1982?

Why does the Saturn V have standalone inter-stage rings?

Cut the gold chain

I don't like coffee, neither beer. How to politely work my way around that in a business situation?

What is "industrial ethernet"?

How to make clear to people I don't want to answer their "Where are you from?" question?

career in signal processing



(Linux) /var/log organisation using logrotate and rsyslog without breaking important systems


logrotate does not compress /var/log/messagesHow can I log iptables in Ubuntu just in /var/log/firewall with rsyslogdLogrotate Successful, original file goes back to original sizeRSyslog does not work with a log file located outside of /var/logRemote rsyslog only writing logging data to /var/log/syslog and not custom logfilesrsyslogd template stopped workingHow can I make rsyslog send the logfiles to a location outside of /var/log?Huge /var/log directory inode in ext3 after creating and removing many filesLogrotate Not Deleting Compressed LogsHow to open multiple log files with less and logrotate?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1















This is likely to elicit calls to close as it's asking for opinions, but I don't know how or where to ask in a more appropriate manner. Apologies in advance if this offends - it's not intended that way, and there is an actual question, which is "what am I going to break if I do this, and is it worth it?"



I hate the way that the /var/log directory gets untidy; there are log files, old log files, and directories also containing both of these. I'm considering using logrotate and rsyslogd to ensure that the directory looks something like this:



chrony
mail
cron
messages


all of which are directories. Each directory would contain a file and a directory:



chrony.log
history


Where logrotate is used to move old logs into the history directory, and the current log is the only file in each directory. I think that this would make it easier to read the directory, to find the relevant log file, and is just, well neater.



I suspect that certain logs are not easily moved - is "lastlog" expected to be in /var/log? Am I going to break anything horribly if I do this?



(I tend to the idea that in general a directory should either be a leaf node or a branch, so I don't like having /etc/httpd.conf and /etc/httpd.conf.d - why not just /etc/httpd.conf.d containing base_config and other files).



Is this all made moot by splunk, I wonder - or by other offline log storage/forwarding?










share|improve this question
























  • Feel free to do what suits you but be aware that pretty much everyone else works with what they have. What they have, is pretty much the same as everyone else. There is a whole internet full of people who write interesting and useful stuff based on what everyone has. Being different in this case probably isn't a good thing.

    – Iain
    Jun 5 at 13:08











  • Everyone isn't the same. Some logs are written to /var/log directly, some to /var/log/<daemon_name>. Some distros use the daemon name, some store them in the base directory. If all logs were written via syslog - as they ought to be - there would be no problem. Given that logs are written either by a logger like rsyslog, or directly, with a config file (ugh!), or (even ughgier!) to a hard-coded file, I realise that some config would be necessary, but don't see what would break, nor why being organised is a bad thing.

    – Graham Nicholls
    Jun 5 at 13:37












  • They are the same - /var/log/<daemon_name> is the same for everyone using <daemon_name>. yada yada yada ...

    – Iain
    Jun 5 at 13:46











  • No, it's not. It's distribution and site - dependent. It's arbitrary, and there's no standard, which is, I suppose, what I'm suggesting.

    – Graham Nicholls
    Jun 6 at 7:21

















-1















This is likely to elicit calls to close as it's asking for opinions, but I don't know how or where to ask in a more appropriate manner. Apologies in advance if this offends - it's not intended that way, and there is an actual question, which is "what am I going to break if I do this, and is it worth it?"



I hate the way that the /var/log directory gets untidy; there are log files, old log files, and directories also containing both of these. I'm considering using logrotate and rsyslogd to ensure that the directory looks something like this:



chrony
mail
cron
messages


all of which are directories. Each directory would contain a file and a directory:



chrony.log
history


Where logrotate is used to move old logs into the history directory, and the current log is the only file in each directory. I think that this would make it easier to read the directory, to find the relevant log file, and is just, well neater.



I suspect that certain logs are not easily moved - is "lastlog" expected to be in /var/log? Am I going to break anything horribly if I do this?



(I tend to the idea that in general a directory should either be a leaf node or a branch, so I don't like having /etc/httpd.conf and /etc/httpd.conf.d - why not just /etc/httpd.conf.d containing base_config and other files).



Is this all made moot by splunk, I wonder - or by other offline log storage/forwarding?










share|improve this question
























  • Feel free to do what suits you but be aware that pretty much everyone else works with what they have. What they have, is pretty much the same as everyone else. There is a whole internet full of people who write interesting and useful stuff based on what everyone has. Being different in this case probably isn't a good thing.

    – Iain
    Jun 5 at 13:08











  • Everyone isn't the same. Some logs are written to /var/log directly, some to /var/log/<daemon_name>. Some distros use the daemon name, some store them in the base directory. If all logs were written via syslog - as they ought to be - there would be no problem. Given that logs are written either by a logger like rsyslog, or directly, with a config file (ugh!), or (even ughgier!) to a hard-coded file, I realise that some config would be necessary, but don't see what would break, nor why being organised is a bad thing.

    – Graham Nicholls
    Jun 5 at 13:37












  • They are the same - /var/log/<daemon_name> is the same for everyone using <daemon_name>. yada yada yada ...

    – Iain
    Jun 5 at 13:46











  • No, it's not. It's distribution and site - dependent. It's arbitrary, and there's no standard, which is, I suppose, what I'm suggesting.

    – Graham Nicholls
    Jun 6 at 7:21













-1












-1








-1








This is likely to elicit calls to close as it's asking for opinions, but I don't know how or where to ask in a more appropriate manner. Apologies in advance if this offends - it's not intended that way, and there is an actual question, which is "what am I going to break if I do this, and is it worth it?"



I hate the way that the /var/log directory gets untidy; there are log files, old log files, and directories also containing both of these. I'm considering using logrotate and rsyslogd to ensure that the directory looks something like this:



chrony
mail
cron
messages


all of which are directories. Each directory would contain a file and a directory:



chrony.log
history


Where logrotate is used to move old logs into the history directory, and the current log is the only file in each directory. I think that this would make it easier to read the directory, to find the relevant log file, and is just, well neater.



I suspect that certain logs are not easily moved - is "lastlog" expected to be in /var/log? Am I going to break anything horribly if I do this?



(I tend to the idea that in general a directory should either be a leaf node or a branch, so I don't like having /etc/httpd.conf and /etc/httpd.conf.d - why not just /etc/httpd.conf.d containing base_config and other files).



Is this all made moot by splunk, I wonder - or by other offline log storage/forwarding?










share|improve this question
















This is likely to elicit calls to close as it's asking for opinions, but I don't know how or where to ask in a more appropriate manner. Apologies in advance if this offends - it's not intended that way, and there is an actual question, which is "what am I going to break if I do this, and is it worth it?"



I hate the way that the /var/log directory gets untidy; there are log files, old log files, and directories also containing both of these. I'm considering using logrotate and rsyslogd to ensure that the directory looks something like this:



chrony
mail
cron
messages


all of which are directories. Each directory would contain a file and a directory:



chrony.log
history


Where logrotate is used to move old logs into the history directory, and the current log is the only file in each directory. I think that this would make it easier to read the directory, to find the relevant log file, and is just, well neater.



I suspect that certain logs are not easily moved - is "lastlog" expected to be in /var/log? Am I going to break anything horribly if I do this?



(I tend to the idea that in general a directory should either be a leaf node or a branch, so I don't like having /etc/httpd.conf and /etc/httpd.conf.d - why not just /etc/httpd.conf.d containing base_config and other files).



Is this all made moot by splunk, I wonder - or by other offline log storage/forwarding?







logging log-files rsyslog var






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 4 at 17:13







Graham Nicholls

















asked Jun 4 at 17:06









Graham NichollsGraham Nicholls

66310




66310












  • Feel free to do what suits you but be aware that pretty much everyone else works with what they have. What they have, is pretty much the same as everyone else. There is a whole internet full of people who write interesting and useful stuff based on what everyone has. Being different in this case probably isn't a good thing.

    – Iain
    Jun 5 at 13:08











  • Everyone isn't the same. Some logs are written to /var/log directly, some to /var/log/<daemon_name>. Some distros use the daemon name, some store them in the base directory. If all logs were written via syslog - as they ought to be - there would be no problem. Given that logs are written either by a logger like rsyslog, or directly, with a config file (ugh!), or (even ughgier!) to a hard-coded file, I realise that some config would be necessary, but don't see what would break, nor why being organised is a bad thing.

    – Graham Nicholls
    Jun 5 at 13:37












  • They are the same - /var/log/<daemon_name> is the same for everyone using <daemon_name>. yada yada yada ...

    – Iain
    Jun 5 at 13:46











  • No, it's not. It's distribution and site - dependent. It's arbitrary, and there's no standard, which is, I suppose, what I'm suggesting.

    – Graham Nicholls
    Jun 6 at 7:21

















  • Feel free to do what suits you but be aware that pretty much everyone else works with what they have. What they have, is pretty much the same as everyone else. There is a whole internet full of people who write interesting and useful stuff based on what everyone has. Being different in this case probably isn't a good thing.

    – Iain
    Jun 5 at 13:08











  • Everyone isn't the same. Some logs are written to /var/log directly, some to /var/log/<daemon_name>. Some distros use the daemon name, some store them in the base directory. If all logs were written via syslog - as they ought to be - there would be no problem. Given that logs are written either by a logger like rsyslog, or directly, with a config file (ugh!), or (even ughgier!) to a hard-coded file, I realise that some config would be necessary, but don't see what would break, nor why being organised is a bad thing.

    – Graham Nicholls
    Jun 5 at 13:37












  • They are the same - /var/log/<daemon_name> is the same for everyone using <daemon_name>. yada yada yada ...

    – Iain
    Jun 5 at 13:46











  • No, it's not. It's distribution and site - dependent. It's arbitrary, and there's no standard, which is, I suppose, what I'm suggesting.

    – Graham Nicholls
    Jun 6 at 7:21
















Feel free to do what suits you but be aware that pretty much everyone else works with what they have. What they have, is pretty much the same as everyone else. There is a whole internet full of people who write interesting and useful stuff based on what everyone has. Being different in this case probably isn't a good thing.

– Iain
Jun 5 at 13:08





Feel free to do what suits you but be aware that pretty much everyone else works with what they have. What they have, is pretty much the same as everyone else. There is a whole internet full of people who write interesting and useful stuff based on what everyone has. Being different in this case probably isn't a good thing.

– Iain
Jun 5 at 13:08













Everyone isn't the same. Some logs are written to /var/log directly, some to /var/log/<daemon_name>. Some distros use the daemon name, some store them in the base directory. If all logs were written via syslog - as they ought to be - there would be no problem. Given that logs are written either by a logger like rsyslog, or directly, with a config file (ugh!), or (even ughgier!) to a hard-coded file, I realise that some config would be necessary, but don't see what would break, nor why being organised is a bad thing.

– Graham Nicholls
Jun 5 at 13:37






Everyone isn't the same. Some logs are written to /var/log directly, some to /var/log/<daemon_name>. Some distros use the daemon name, some store them in the base directory. If all logs were written via syslog - as they ought to be - there would be no problem. Given that logs are written either by a logger like rsyslog, or directly, with a config file (ugh!), or (even ughgier!) to a hard-coded file, I realise that some config would be necessary, but don't see what would break, nor why being organised is a bad thing.

– Graham Nicholls
Jun 5 at 13:37














They are the same - /var/log/<daemon_name> is the same for everyone using <daemon_name>. yada yada yada ...

– Iain
Jun 5 at 13:46





They are the same - /var/log/<daemon_name> is the same for everyone using <daemon_name>. yada yada yada ...

– Iain
Jun 5 at 13:46













No, it's not. It's distribution and site - dependent. It's arbitrary, and there's no standard, which is, I suppose, what I'm suggesting.

– Graham Nicholls
Jun 6 at 7:21





No, it's not. It's distribution and site - dependent. It's arbitrary, and there's no standard, which is, I suppose, what I'm suggesting.

– Graham Nicholls
Jun 6 at 7:21










1 Answer
1






active

oldest

votes


















1














Yes, log files and config files are a mess. That's what happens every software project invents their own. Then opinionated sysadmins package them up into Linux distros, and doing unprivileged logging sometimes requires a directory with special permissions.



I'm not going to enumerate everything that you would have to change to restructure /var/log arbitrarily, but here are some categories:



  • Configuration files logging there, including logrotate.

  • Compiled in paths. I don't know where exactly in the auth stack /var/log/lastlog is configured.

  • Security build including file permissions and SELinux. Something is labeling logrotate as lastlog_t on CentOS.

  • Documentation of the differences from the distro and the Linux FHS. Just because FHS says /var/log/messages is the syslog file doesn't make it happen, but it is documented precedent.

Do what you want. Personally, I'm not going to mess with it when I can grep through files recursively. Or search a systemd journal. Or even better, forward logs to a central search engine.






share|improve this answer























  • This could be one of the advantages of systemd - I'm not a fan in general, but it could make this issue moot.

    – Graham Nicholls
    Jun 5 at 13:39











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
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%2fserverfault.com%2fquestions%2f970100%2flinux-var-log-organisation-using-logrotate-and-rsyslog-without-breaking-impor%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Yes, log files and config files are a mess. That's what happens every software project invents their own. Then opinionated sysadmins package them up into Linux distros, and doing unprivileged logging sometimes requires a directory with special permissions.



I'm not going to enumerate everything that you would have to change to restructure /var/log arbitrarily, but here are some categories:



  • Configuration files logging there, including logrotate.

  • Compiled in paths. I don't know where exactly in the auth stack /var/log/lastlog is configured.

  • Security build including file permissions and SELinux. Something is labeling logrotate as lastlog_t on CentOS.

  • Documentation of the differences from the distro and the Linux FHS. Just because FHS says /var/log/messages is the syslog file doesn't make it happen, but it is documented precedent.

Do what you want. Personally, I'm not going to mess with it when I can grep through files recursively. Or search a systemd journal. Or even better, forward logs to a central search engine.






share|improve this answer























  • This could be one of the advantages of systemd - I'm not a fan in general, but it could make this issue moot.

    – Graham Nicholls
    Jun 5 at 13:39















1














Yes, log files and config files are a mess. That's what happens every software project invents their own. Then opinionated sysadmins package them up into Linux distros, and doing unprivileged logging sometimes requires a directory with special permissions.



I'm not going to enumerate everything that you would have to change to restructure /var/log arbitrarily, but here are some categories:



  • Configuration files logging there, including logrotate.

  • Compiled in paths. I don't know where exactly in the auth stack /var/log/lastlog is configured.

  • Security build including file permissions and SELinux. Something is labeling logrotate as lastlog_t on CentOS.

  • Documentation of the differences from the distro and the Linux FHS. Just because FHS says /var/log/messages is the syslog file doesn't make it happen, but it is documented precedent.

Do what you want. Personally, I'm not going to mess with it when I can grep through files recursively. Or search a systemd journal. Or even better, forward logs to a central search engine.






share|improve this answer























  • This could be one of the advantages of systemd - I'm not a fan in general, but it could make this issue moot.

    – Graham Nicholls
    Jun 5 at 13:39













1












1








1







Yes, log files and config files are a mess. That's what happens every software project invents their own. Then opinionated sysadmins package them up into Linux distros, and doing unprivileged logging sometimes requires a directory with special permissions.



I'm not going to enumerate everything that you would have to change to restructure /var/log arbitrarily, but here are some categories:



  • Configuration files logging there, including logrotate.

  • Compiled in paths. I don't know where exactly in the auth stack /var/log/lastlog is configured.

  • Security build including file permissions and SELinux. Something is labeling logrotate as lastlog_t on CentOS.

  • Documentation of the differences from the distro and the Linux FHS. Just because FHS says /var/log/messages is the syslog file doesn't make it happen, but it is documented precedent.

Do what you want. Personally, I'm not going to mess with it when I can grep through files recursively. Or search a systemd journal. Or even better, forward logs to a central search engine.






share|improve this answer













Yes, log files and config files are a mess. That's what happens every software project invents their own. Then opinionated sysadmins package them up into Linux distros, and doing unprivileged logging sometimes requires a directory with special permissions.



I'm not going to enumerate everything that you would have to change to restructure /var/log arbitrarily, but here are some categories:



  • Configuration files logging there, including logrotate.

  • Compiled in paths. I don't know where exactly in the auth stack /var/log/lastlog is configured.

  • Security build including file permissions and SELinux. Something is labeling logrotate as lastlog_t on CentOS.

  • Documentation of the differences from the distro and the Linux FHS. Just because FHS says /var/log/messages is the syslog file doesn't make it happen, but it is documented precedent.

Do what you want. Personally, I'm not going to mess with it when I can grep through files recursively. Or search a systemd journal. Or even better, forward logs to a central search engine.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jun 5 at 10:12









John MahowaldJohn Mahowald

10.9k1714




10.9k1714












  • This could be one of the advantages of systemd - I'm not a fan in general, but it could make this issue moot.

    – Graham Nicholls
    Jun 5 at 13:39

















  • This could be one of the advantages of systemd - I'm not a fan in general, but it could make this issue moot.

    – Graham Nicholls
    Jun 5 at 13:39
















This could be one of the advantages of systemd - I'm not a fan in general, but it could make this issue moot.

– Graham Nicholls
Jun 5 at 13:39





This could be one of the advantages of systemd - I'm not a fan in general, but it could make this issue moot.

– Graham Nicholls
Jun 5 at 13:39

















draft saved

draft discarded
















































Thanks for contributing an answer to Server Fault!


  • 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%2fserverfault.com%2fquestions%2f970100%2flinux-var-log-organisation-using-logrotate-and-rsyslog-without-breaking-impor%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

Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company