Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I edit AdGuardHome.yaml about the log section it doesn't seem to take effect #6093

Closed
4 tasks done
MiKing233 opened this issue Aug 10, 2023 · 5 comments
Closed
4 tasks done
Assignees
Milestone

Comments

@MiKing233
Copy link

Prerequisites

Platform (OS and CPU architecture)

Linux, ARM64

Installation

Custom package (OpenWrt, HomeAssistant, etc; please mention in the description)

Setup

On one machine

AdGuard Home version

v0.107.36

Action

我遇到一些問題, 發現AdGuardHome會無節制的向我的/tmp輸出log日志, 直到填滿我的/tmp, 這將導致其他相關服務停擺, 我瞭解到AdGuardHome的配置文件中可以對log輸出行爲進行設定

在我的/etc/AdGuardHome.yaml中, 我的log配置部分内容如下

log:
  file: ""
  max_backups: 0
  max_size: 10
  max_age: 1
  compress: true
  local_time: true
  verbose: false

關於我瞭解到的内容
file: log文件的存放路徑
max_backups: 指定保留的日志文件备份数量
max_size: 指定日志文件的最大大小 (以MB为单位)
max_age: 指定日志文件的最长存储时间(以天为单位)
compress: 设置是否压缩日志文件
local_time: 指定是否使用本地时间记录日志
verbose: 指定日志记录的详细程度

Expected result

對於目前我的log配置, 預期結果應爲:
log將默認輸出在/tmp/AdGuardHome.log
AdGuardHome將不保留log备份文件
日志文件的最大大小是100MB
日志文件最长存储1天
AdGuardHome將對log文件進行壓縮
AdGuardHome將使用本地时间记录log
详细日志是關閉的

Actual result

但我實際看到的是, AdGuardHome仍然在以每100MB/個的大小對日志進行切割, 在/tmp中使用ll -h檢查如下

-rw------- 1 root root 100.0M Aug 9 18:26 AdGuardHome-2023-08-09T10-26-10.364.log
-rw------- 1 root root 100.0M Aug 9 20:42 AdGuardHome-2023-08-09T12-42-34.702.log
-rw------- 1 root root 100.0M Aug 9 23:54 AdGuardHome-2023-08-09T15-54-29.918.log
-rw------- 1 root root 100.0M Aug 10 03:02 AdGuardHome-2023-08-09T19-02-24.025.log
-rw------- 1 root root 100.0M Aug 10 07:33 AdGuardHome-2023-08-09T23-33-22.349.log
-rw------- 1 root root 26.6M Aug 10 08:40 AdGuardHome.log

除了AdGuardHome.log是預期的log輸出檔案外, 我不清楚以上的幾個以100MB分割的log是如何被輸出的, 并且我已經在AdGuardHome.yaml中用於區分將max_size設定爲10 (MB), 但實際仍然以100MB來切割, 并且我還發現max_age參數也不生效, 它并不會只保留一天的log量, 即使我設定max_age: 1, 他仍然會一直如此輸出直至/tmp被寫入滿, 此外local_time似乎也沒有正常工作, 我已經制定爲了true但我檢查保存的log日志發現他并不是以我當前設備的時間來記錄的;

還有一些我不能確定是否在按預期工作的
verbose: false 我不確定是否禁用了详细记录日志的功能, 但我檢查log發現仍然有大量的[debug]被輸出, 我懷疑他沒有生效
compress: true 我不確定AdGuardHome是否真的對log進行了壓縮

經過我測試, 似乎只有這一個在正常工作
file: ""
當我輸入我的目標文件路徑后, 例如file: "/tmp/adgh.log", 啓動AdGuardHome, 它會被自動更改為file: /tmp/adgh.log (引號將被自動去除), 但實際結果是正確的, 它會被輸出在指定的路徑上

我有很多疑問, 爲何AdGuardHome.yaml中的log部分大多數都不按指定的設定進行?
我檢索了相關資料, 找到了一些内容, 在How to configure AdGuard Home to write verbose-level logs?中, 有如下的描述
image

指示在v0.107.34之後, 使用了類似與log.file和log.verbose的設定, 在Before v0.107.34 use verbose and log_file

對於我目前的v0.107.36, 我嘗試將AdGuardHome.yaml中的log部分修改爲了如下配置

log:
  log.file: ""
  max_backups: 0
  max_size: 10
  max_age: 1
  compress: true
  local_time: true
  log.verbose: false

但當我運行AdGuardHome后, 再次檢查AdGuardHome.yaml, 發現已經被自動恢復原樣

log:
  file: ""
  max_backups: 0
  max_size: 10
  max_age: 1
  compress: true
  local_time: true
  verbose: false

難道是我設定的方式不對嗎, 還是AdGuardHome本身的Bug導致的問題, 又或是之後的版本對這部分又進行了修改, 我要如何設定才能讓log按照我的要求進行輸出從而避免無節制的輸出使得/tmp被寫滿, 目前我只能透過每天手動刪除log檔案來維持設備的正常運作, 這個問題正困擾著我😵‍💫

Additional information and/or screenshots

No response

@ainar-g ainar-g added the needs investigation Needs to be reproduced reliably. label Aug 10, 2023
@ainar-g ainar-g added this to the v0.107.37 milestone Aug 10, 2023
@ainar-g
Copy link
Contributor

ainar-g commented Aug 10, 2023

log.file means “property file of object log”, and the properties aren't applied when you don't set the file. But there also seems to be a bug regarding the other log settings.

@Mizzick, please investigate.

@Mizzick
Copy link
Contributor

Mizzick commented Aug 11, 2023

Indeed, there is a bug to fix, I can reproduce it.

@ainar-g ainar-g added bug P3: Medium and removed needs investigation Needs to be reproduced reliably. labels Aug 11, 2023
adguard pushed a commit that referenced this issue Aug 14, 2023
Updates #6093.

Squashed commit of the following:

commit f3478b9
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Aug 11 15:27:51 2023 +0300

    home: imp code

commit 07b51d8
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Aug 11 15:18:00 2023 +0300

    all: imp docs

commit 4892c86
Merge: 7cb376c c54635e
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Aug 11 13:57:02 2023 +0300

    Merge remote-tracking branch 'origin/master' into 6093-log-conf

commit 7cb376c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Aug 11 12:48:26 2023 +0300

    all: docs

commit 89f0d46
Merge: 67c7767 94cf50a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Aug 11 12:46:26 2023 +0300

    Merge remote-tracking branch 'origin/master' into 6093-log-conf

commit 67c7767
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Aug 11 12:39:26 2023 +0300

    home: log conf
@Mizzick
Copy link
Contributor

Mizzick commented Aug 15, 2023

Please check the edge channel, we have published v0.108.0-a.651+85e87b9c with the fix for this issue.

@ainar-g
Copy link
Contributor

ainar-g commented Aug 21, 2023

We'll close the issue for now. Please feel free to reopen if you find that the fix didn't work.

@ainar-g ainar-g closed this as completed Aug 21, 2023
@a904055262

This comment was marked as off-topic.

@ainar-g ainar-g modified the milestones: v0.107.38, v0.107.37 Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants