Logrotate to clean up date stamped files

后端 未结 6 1041
梦谈多话
梦谈多话 2021-01-31 17:22

I\'m currently trying to work out a method of tidying up Oracle Recover log files that are created by Cron...

Currently, our Oracle standby recover process is invoked b

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-31 18:05

    FYI I know that this is an old question, but the reason why it does not work for you is because your dateformat is not lexically sortable. From the manpage:

       dateformat format_string
              Specify the extension for dateext using the notation similar to strftime(3)  function.  Only
              %Y  %m  %d  and %s specifiers are allowed.  The default value is -%Y%m%d. Note that also the
              character separating log name from the extension is part of the dateformat string. The  sys-
              tem  clock must be set past Sep 9th 2001 for %s to work correctly.  Note that the datestamps
              generated by this format must be lexically sortable (i.e., first the year,  then  the  month
              then  the  day.  e.g.,  2001/12/01 is ok, but 01/12/2001 is not, since 01/11/2002 would sort
              lower while it is later).  This is because when using the rotate option, logrotate sorts all
              rotated filenames to find out which logfiles are older and should be removed.
    

    The solution is to either change to one that goes year-month-date, or call an external process to perform the cleanup.

提交回复
热议问题