- **status**: unassigned --> fixed
- **Comment**:

commit 8742197dee4c0afe3ff84a13312dd2ba59e9e785 (HEAD -> develop, 
origin/develop, ticket-3045)
Author: Canh Van Truong <[email protected]>
Date:   Fri Jun 7 16:52:04 2019 +0700

    log: fix to remove the cfg file when log file rotation [#3045]

    If the date(include year, month and day) in oldest cfg file name and the
    date of created oldest log file is different, logd cannot find out the
    oldest cfg file. The oldest cfg file is never removed when log file 
rotation.
    So number of cfg file is huge after time while the log file has already been
    rotated.

    Update to remove the cfg in this case.
    Also limit the number of cfg files should be removed if there are still huge
    cfg files in disk to avoid hanging main thread




---

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

**Status:** fixed
**Milestone:** 5.19.06
**Created:** Tue May 28, 2019 04:27 AM UTC by Canh Truong
**Last Updated:** Wed May 29, 2019 07:30 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. 

Some cases cfg file will never deleted in rotation:
1/ If oldest cfg file is deleted fail, log service may never find out  oldest 
cfg file in next rotation because the "cfgolddate" of oldest cfg file is 
different with "logolddate" of oldest log file . That causes the cfg file will 
never be deleted when log file is rotated in next time.

2/ 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). That causes we cannot find the oldest cfg file 
"oldest_file" in the rotation.

The number of cfg file = number of log file + 1 after log rotation. That is not 
right.


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);
      }
    }
...
}


---

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