[asterisk-users] rotatestrategy = none not working

Steve Edwards asterisk.org at sedwards.com
Wed May 20 20:12:56 CDT 2020


> On Wed, 20 May 2020, David Cunningham wrote:
>
>> Thanks for the answer. Since that's what we already have configured, any 
>> idea why it wouldn't work? As I said, when "asterisk -rx 'logger reload'" 
>> is run it still rotates the log file.
>
> Sorry. No clues.

Here's a clue from asterisk-11.3.0-rc1/main/logger.c:

(line 94)
static enum rotatestrategy {
          SEQUENTIAL = 1 << 0,     /* Original method - create a new file, in order */
          ROTATE = 1 << 1,         /* Rotate all files, such that the oldest file has the highest suffix */
          TIMESTAMP = 1 << 2,      /* Append the epoch timestamp onto the end of the archived file */
} rotatestrategy = SEQUENTIAL;

So the default strategy is SEQUENTIAL.

(line 423)
          if ((s = ast_variable_retrieve(cfg, "general", "rotatestrategy"))) {
                  if (strcasecmp(s, "timestamp") == 0) {
                          rotatestrategy = TIMESTAMP;
                  } else if (strcasecmp(s, "rotate") == 0) {
                          rotatestrategy = ROTATE;
                  } else if (strcasecmp(s, "sequential") == 0) {
                          rotatestrategy = SEQUENTIAL;
                  } else {
                          fprintf(stderr, "Unknown rotatestrategy: %s\n", s);
                  }

So, since 'none' is not a valid option, the default remains set.

Since the code casually appears the same in 11.17.1, I'll have to 
backtrack on my assessment that 11.17.1 doesn't rotate without a more in 
depth analysis.

I don't know when 'none' became a valid option, but 17.4.0 has these as 
the respective snippets:

static enum rotatestrategy {
          NONE = 0,                /* Do not rotate log files at all, instead rely on external mechanisms */
          SEQUENTIAL = 1 << 0,     /* Original method - create a new file, in order */
          ROTATE = 1 << 1,         /* Rotate all files, such that the oldest file has the highest suffix */
          TIMESTAMP = 1 << 2,      /* Append the epoch timestamp onto the end of the archived file */
} rotatestrategy = SEQUENTIAL;

          if ((s = ast_variable_retrieve(cfg, "general", "rotatestrategy"))) {
                  if (strcasecmp(s, "timestamp") == 0) {
                          rotatestrategy = TIMESTAMP;
                  } else if (strcasecmp(s, "rotate") == 0) {
                          rotatestrategy = ROTATE;
                  } else if (strcasecmp(s, "sequential") == 0) {
                          rotatestrategy = SEQUENTIAL;
                  } else if (strcasecmp(s, "none") == 0) {
                          rotatestrategy = NONE;
                  } else {
                          fprintf(stderr, "Unknown rotatestrategy: %s\n", s);
                  }

So, backport or upgrade?

Also, inquiring minds want to know why the enum is in powers of 2? It's 
not like we can set sequential AND timestamp.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
              https://www.linkedin.com/in/steve-edwards-4244281

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
             https://www.linkedin.com/in/steve-edwards-4244281



More information about the asterisk-users mailing list