AIX Open Source

 View Only
Expand all | Collapse all

Logrotate home expansion not working

  • 1.  Logrotate home expansion not working

    Posted Wed February 20, 2019 10:57 AM

    Originally posted by: sailaway


    Currently using logrotate rpm 3.14.0-2 downloaded from AIX toolbox on AIX 7.2. 

    I have a problem when trying to use user home directory expansion in the logrotate.conf. 

    First I created a testlog in root home directory as "touch ~/testlog"

    - If i use the tilde expansion with double quote in the logrotate.conf as follow:

    "~/testlog" {}
       then the debug will output error:

    considering log ~/testlog
    error: stat of ~ failed: A file or directory in the path name does not exist.

    - If I use tilde expansion without any double quote as follow:

    ~/testlog {}
      then the debug will output error:

    error: /etc/logrotate.conf:51 lines must begin with a keyword or a filename (possibly in double quotes)

    Is there any workaround to specify home directory as a variable in  the logrotate config file? 

     

     



  • 2.  Re: Logrotate home expansion not working

    Posted Wed February 20, 2019 11:14 AM

    Originally posted by: AyappanP


    Man page of logrotate says this.,

              The last section uses tilde expansion to rotate log files in
              the home directory of the current user. This is only
              available, if your glob library supports tilde expansion.
              GNU glob does support this.

     

    So it appears to me that AIX libc glob may not be supporting this.

    We will check on this more. 



  • 3.  Re: Logrotate home expansion not working

    Posted Wed February 20, 2019 11:18 AM

    Originally posted by: sailaway


    Thanks for looking into this. 



  • 4.  Re: Logrotate home expansion not working

    Posted Thu February 21, 2019 04:01 AM

    Originally posted by: AyappanP


    Confirming that AIX (6.1, 7.1, 7.2) glob don't support tilde expansion. 

     Not sure whether any workaround is there for this , other than just hardcode the user home directory.



  • 5.  Re: Logrotate home expansion not working

    Posted Thu February 21, 2019 09:10 AM

    Originally posted by: sailaway


    Thanks for confirming it. I was trying to keep my Ansible playbook compact but I just wrote another task to collect the user home directory from shell script as a workaround.