Пользовательская переменная в конфигурации nginx в «сервере» не будет разрешена

попробуй это:

  #!/usr/bin/awk -f
  BEGIN {
        #FPAT = "([^,]+)|(\"[^\"]+\")" # seperator is,
        #FPAT = "([^,]*)|(\"[^\"]*\")" # seperator is, and allow empty field -> notice the "+" changed to "*"
        FPAT = "([^ ]+)|(\"[^\"]*\")" # seperator is  -> notice the "," changed to " "
  }
  {
    printf("%d: ", FNR);
        for (i = 1; i <= NF; i++) {
            printf("%s ", $i)
        }
    printf("\n");
  }

Я взял его из онлайн-руководства по GNU awk. Вот.https://www.gnu.org/software/gawk/manual/html_node/Splitting-By-Content.html

1
25.09.2020, 23:13
1 ответ

Даже если вы каким-то образом заработаете, вам действительно не следует использовать этот метод:

The file path can contain variables (0.7.6+), but such logs have some constraints:

  • the user whose credentials are used by worker processes should have permissions to create files in a directory with such logs;
  • buffered writes do not work;
  • the file is opened and closed for each log write. However, since the descriptors of frequently used files can be stored in a cache, writing to the old file can continue during the time specified by the open_log_file_cache directive’s valid parameter
  • [..]

Кроме того, error_logвообще не принимает переменные.

Лучше использовать язык шаблонов/макросов для создания конфигураций. (Я предпочитаю для этого m4, см.man m4).

1
18.03.2021, 23:02

Теги

Похожие вопросы