---

** [tickets:#3045] log: the cfg file never be removed **

**Status:** unassigned
**Milestone:** 5.19.06
**Created:** Tue May 28, 2019 04:27 AM UTC by Canh Truong
**Last Updated:** Tue May 28, 2019 04:27 AM UTC
**Owner:** nobody


when log file is rotated, the oldest log files are deleted to make sure the 
number log files is less than "maxFilesRotated".  The oldest cfg is also 
checked and deleted. 

If oldest cfg file is deleted fail, log service may never find out which oldest 
cfg file in next rotation. That causes the cfg file will never be deleted when 
log file is rotated.

int get_number_of_cfg_files_hdl() {
....
    if ((old_ind != -1) && (***cfgolddate == logolddate***) &&
        (cfg_old_time <= log_old_time)) {
      TRACE_1(" (cfg_old_date:%d == log_old_date:%d) &&"
              " (cfg_old_time:%d <= log_old_time:%d )",
              cfg_old_date, log_old_date, cfg_old_time, log_old_time);
      TRACE_1("oldest: %s", cfg_namelist[old_ind]->d_name);
      n = snprintf(oldest_file, max_outsize, "%s/%s", path.c_str(),
                   cfg_namelist[old_ind]->d_name);

      if (n < 0 || static_cast<uint32_t>(n) >= max_outsize) {
        LOG_WA("oldest_file > max_outsize");
        rc = -1;
        goto done_cfg_free;
      } else {
        rc = (cfg_files - failed);
      }
    }
  }
...
}

The "cfgolddate" is not alway equal with "logolddate" if the deleting of cfg 
fail in previous or the closing cfg/log file in old day and creating new 
cfg/log file in new day. (E.g. close cfg/log file at 23:59:59 of day and 
creating log file at 00:00:00 of new day)



---

Sent from sourceforge.net because [email protected] is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to