rsyslog doesnt seem to write to log file, without restart after touch'ing the file












0















I have a separate file for logging local7 facility, and this file is touched and
permissions set, from my installer. But sometimes I see that the logs are not being written to it (after I do a re-install) until I do rsyslog restart!



Is it mandatory to restart rsyslog if the log file is touched by another program/application ?



(since the installer is run as root, the
log file's time-stamp will be changed due to touch - will this cause rsyslog to not write to the log file ?)










share|improve this question





























    0















    I have a separate file for logging local7 facility, and this file is touched and
    permissions set, from my installer. But sometimes I see that the logs are not being written to it (after I do a re-install) until I do rsyslog restart!



    Is it mandatory to restart rsyslog if the log file is touched by another program/application ?



    (since the installer is run as root, the
    log file's time-stamp will be changed due to touch - will this cause rsyslog to not write to the log file ?)










    share|improve this question



























      0












      0








      0








      I have a separate file for logging local7 facility, and this file is touched and
      permissions set, from my installer. But sometimes I see that the logs are not being written to it (after I do a re-install) until I do rsyslog restart!



      Is it mandatory to restart rsyslog if the log file is touched by another program/application ?



      (since the installer is run as root, the
      log file's time-stamp will be changed due to touch - will this cause rsyslog to not write to the log file ?)










      share|improve this question
















      I have a separate file for logging local7 facility, and this file is touched and
      permissions set, from my installer. But sometimes I see that the logs are not being written to it (after I do a re-install) until I do rsyslog restart!



      Is it mandatory to restart rsyslog if the log file is touched by another program/application ?



      (since the installer is run as root, the
      log file's time-stamp will be changed due to touch - will this cause rsyslog to not write to the log file ?)







      rsyslog






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 8 '14 at 16:59







      vyom

















      asked Oct 8 '14 at 11:11









      vyomvyom

      133114




      133114






















          1 Answer
          1






          active

          oldest

          votes


















          0














          rsyslogd has each log file open continuously for writing and it doesn't know that you've yanked the file out from under it. The file your installer removed is still on disk in an unlinked state and is still being written to. You can tell rsyslogd to reopen all log files by killall -HUP rsyslogd instead of doing a full restart.






          share|improve this answer
























          • my installer is not removing the file, its just doing a touch + chmod - for this too, do I need a kill -HUP ?

            – vyom
            Oct 8 '14 at 12:59











          • @vyom Your installer is creating a new file via touch according to your post. If you create a new file you will need to send a HUP to rsyslogd or restart it. If you are just changing a timestamp or permissions then you do not need to do anything.

            – Doug O'Neal
            Oct 8 '14 at 16:34













          • ok, I meant touch, I have edited the question, to keep it simple, the installer always does a touch <file> and then chmod on it. So, from your explanation I dont need a HUP, but somehow I see this issue that after an installation the logging not happening until I restart rsyslog !

            – vyom
            Oct 8 '14 at 17:00











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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%2funix.stackexchange.com%2fquestions%2f160016%2frsyslog-doesnt-seem-to-write-to-log-file-without-restart-after-touching-the-fi%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









          0














          rsyslogd has each log file open continuously for writing and it doesn't know that you've yanked the file out from under it. The file your installer removed is still on disk in an unlinked state and is still being written to. You can tell rsyslogd to reopen all log files by killall -HUP rsyslogd instead of doing a full restart.






          share|improve this answer
























          • my installer is not removing the file, its just doing a touch + chmod - for this too, do I need a kill -HUP ?

            – vyom
            Oct 8 '14 at 12:59











          • @vyom Your installer is creating a new file via touch according to your post. If you create a new file you will need to send a HUP to rsyslogd or restart it. If you are just changing a timestamp or permissions then you do not need to do anything.

            – Doug O'Neal
            Oct 8 '14 at 16:34













          • ok, I meant touch, I have edited the question, to keep it simple, the installer always does a touch <file> and then chmod on it. So, from your explanation I dont need a HUP, but somehow I see this issue that after an installation the logging not happening until I restart rsyslog !

            – vyom
            Oct 8 '14 at 17:00
















          0














          rsyslogd has each log file open continuously for writing and it doesn't know that you've yanked the file out from under it. The file your installer removed is still on disk in an unlinked state and is still being written to. You can tell rsyslogd to reopen all log files by killall -HUP rsyslogd instead of doing a full restart.






          share|improve this answer
























          • my installer is not removing the file, its just doing a touch + chmod - for this too, do I need a kill -HUP ?

            – vyom
            Oct 8 '14 at 12:59











          • @vyom Your installer is creating a new file via touch according to your post. If you create a new file you will need to send a HUP to rsyslogd or restart it. If you are just changing a timestamp or permissions then you do not need to do anything.

            – Doug O'Neal
            Oct 8 '14 at 16:34













          • ok, I meant touch, I have edited the question, to keep it simple, the installer always does a touch <file> and then chmod on it. So, from your explanation I dont need a HUP, but somehow I see this issue that after an installation the logging not happening until I restart rsyslog !

            – vyom
            Oct 8 '14 at 17:00














          0












          0








          0







          rsyslogd has each log file open continuously for writing and it doesn't know that you've yanked the file out from under it. The file your installer removed is still on disk in an unlinked state and is still being written to. You can tell rsyslogd to reopen all log files by killall -HUP rsyslogd instead of doing a full restart.






          share|improve this answer













          rsyslogd has each log file open continuously for writing and it doesn't know that you've yanked the file out from under it. The file your installer removed is still on disk in an unlinked state and is still being written to. You can tell rsyslogd to reopen all log files by killall -HUP rsyslogd instead of doing a full restart.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 8 '14 at 12:32









          Doug O'NealDoug O'Neal

          2,8521817




          2,8521817













          • my installer is not removing the file, its just doing a touch + chmod - for this too, do I need a kill -HUP ?

            – vyom
            Oct 8 '14 at 12:59











          • @vyom Your installer is creating a new file via touch according to your post. If you create a new file you will need to send a HUP to rsyslogd or restart it. If you are just changing a timestamp or permissions then you do not need to do anything.

            – Doug O'Neal
            Oct 8 '14 at 16:34













          • ok, I meant touch, I have edited the question, to keep it simple, the installer always does a touch <file> and then chmod on it. So, from your explanation I dont need a HUP, but somehow I see this issue that after an installation the logging not happening until I restart rsyslog !

            – vyom
            Oct 8 '14 at 17:00



















          • my installer is not removing the file, its just doing a touch + chmod - for this too, do I need a kill -HUP ?

            – vyom
            Oct 8 '14 at 12:59











          • @vyom Your installer is creating a new file via touch according to your post. If you create a new file you will need to send a HUP to rsyslogd or restart it. If you are just changing a timestamp or permissions then you do not need to do anything.

            – Doug O'Neal
            Oct 8 '14 at 16:34













          • ok, I meant touch, I have edited the question, to keep it simple, the installer always does a touch <file> and then chmod on it. So, from your explanation I dont need a HUP, but somehow I see this issue that after an installation the logging not happening until I restart rsyslog !

            – vyom
            Oct 8 '14 at 17:00

















          my installer is not removing the file, its just doing a touch + chmod - for this too, do I need a kill -HUP ?

          – vyom
          Oct 8 '14 at 12:59





          my installer is not removing the file, its just doing a touch + chmod - for this too, do I need a kill -HUP ?

          – vyom
          Oct 8 '14 at 12:59













          @vyom Your installer is creating a new file via touch according to your post. If you create a new file you will need to send a HUP to rsyslogd or restart it. If you are just changing a timestamp or permissions then you do not need to do anything.

          – Doug O'Neal
          Oct 8 '14 at 16:34







          @vyom Your installer is creating a new file via touch according to your post. If you create a new file you will need to send a HUP to rsyslogd or restart it. If you are just changing a timestamp or permissions then you do not need to do anything.

          – Doug O'Neal
          Oct 8 '14 at 16:34















          ok, I meant touch, I have edited the question, to keep it simple, the installer always does a touch <file> and then chmod on it. So, from your explanation I dont need a HUP, but somehow I see this issue that after an installation the logging not happening until I restart rsyslog !

          – vyom
          Oct 8 '14 at 17:00





          ok, I meant touch, I have edited the question, to keep it simple, the installer always does a touch <file> and then chmod on it. So, from your explanation I dont need a HUP, but somehow I see this issue that after an installation the logging not happening until I restart rsyslog !

          – vyom
          Oct 8 '14 at 17:00


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • 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%2funix.stackexchange.com%2fquestions%2f160016%2frsyslog-doesnt-seem-to-write-to-log-file-without-restart-after-touching-the-fi%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

          How to make a Squid Proxy server?

          第一次世界大戦

          Touch on Surface Book