Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-1677

logrotate ambiguity of filename

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.3
    • Component/s: Logging
    • Labels:
      None

      Description

      For a host "foo.example.org" the code logs its activity in:
      <pre>
      /var/cfengine/cf3.foo.runlog
      </pre>

      Note the short-form, unqualified hostname "foo".

      In "def.cf", an attempt is made to include this filename in "base_log_files" to drive the rotation of this logfile:

      <pre>
      "base_log_files" slist =>

      { "$(sys.workdir)/cf3.$(sys.host).runlog", "$(sys.workdir)/promise_summary.log", }

      ;
      </pre>

      But this can fail to find the runlog file.

      The documentation for "sys.host" says "It is undefined whether this is qualified or unqualified with a domain name." In our case, it ends up as "foo.example.org", so the log rotation attempts to find the file named with the fully-qualified hostname.

      Underlying this is a mismatch between how the code writing the "runlog" file chooses the host component of the filename (it seems to choose unqualified) and how the policy rotating runlog tries to find it (in our installation "sys.host" seems to expand to fully-qualified).

      Our quick-fix is to try both forms of filename:

      <pre>
      "base_log_files" slist =>

      { ###"$(sys.workdir)/cf3.$(sys.host).runlog", "$(sys.workdir)/cf3.$(sys.uqhost).runlog", "$(sys.workdir)/cf3.$(sys.fqhost).runlog", "$(sys.workdir)/promise_summary.log", }

      ;
      </pre>

      But I suggest that a more integrated review of this would be appropriate.

        Attachments

          Activity

            People

            • Assignee:
              a10042 Nick Anderson
              Reporter:
              davidlee David Lee
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel