今天刚试了下 mosdns,手撸配置试了下正常,问题是怎么没有日志输出 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Vtoecha
V2EX    DNS

今天刚试了下 mosdns,手撸配置试了下正常,问题是怎么没有日志输出

  •  
  •   Vtoecha 218 天前 2144 次点击
    这是一个创建于 218 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用的最新版,log 怎么配置都没有其他输出。 就输出启动完的日志就没了INFO all plugins are loaded。 想开 debug 看下交互日志都没有。 不知道是不是我配置有问题。。。

    log: level: debug plugins: # 缓存 - tag: cache type: cache args: size: 10240 lazy_cache_ttl: 86400 # 转发本地 DNS - tag: forward_local type: forward args: concurrent: 1 upstreams: - addr: udp://192.168.88.1 # 转发国外 DNS - tag: forward_remote type: forward args: concurrent: 1 upstreams: - addr: 192.168.88.2:5353 # china ip - tag: cn_ip type: ip_set args: files: - /etc/mosdns/CN-ip-cidr.txt # lan ip - tag: lan_ip type: ip_set args: files: - /etc/mosdns/LAN-ip-cidr.txt # 直连域名 - tag: direct_list type: domain_set args: files: - /etc/mosdns/direct-list.txt # 代理域名 - tag: proxy_list type: domain_set args: files: - /etc/mosdns/proxy-list.txt # fallback 的 primary 服务器 - tag: local_sequence type: sequence args: - exec: $forward_local - matches: resp_ip $lan_ip exec: accept - matches: resp_ip $cn_ip exec: accept - exec: drop_resp # fallback 的 secondary 服务器 - tag: remote_sequence type: sequence args: - exec: $forward_remote - exec: accept # fallback sequence - tag: fallback type: fallback args: primary: local_sequence secondary: remote_sequence threshold: 500 always_standby: true # 主运行序列 - tag: main_sequence type: sequence args: # drop https query type - matches: - qtype 65 exec: reject 3 # handle local ptr - matches: - qtype 12 exec: $forward_local - matches: has_resp exec: accept # 国内直连域名 - matches: - qname $direct_list exec: $forward_local - matches: has_resp exec: accept # 国外代理域名 - matches: - qname $proxy_list exec: $forward_remote - matches: has_resp exec: accept - exec: $fallback # 启动监听服务 - tag: udp_server type: udp_server args: entry: main_sequence listen: :53 - tag: tcp_server type: tcp_server args: entry: main_sequence listen: :53 
    7 条回复    2025-04-20 12:27:04 +08:00
    wander555
        1
    wander555  
       218 天前
    log:
    level: debug
    file: "/etc/mosdns/moslog.log"

    加个地址
    Vtoecha
        2
    Vtoecha  
    OP
       218 天前
    @wander555 这试过了,输出就这些
    ```shell

    tt@mosdns:~$ sudo systemctl status mosdns
    ● mosdns.service - A DNS forwarder
    Loaded: loaded (/etc/systemd/system/mosdns.service; enabled; preset: enabled)
    Active: active (running) since Thu 2025-03-06 13:38:18 CST; 29s ago
    Main PID: 2911 (mosdns)
    Tasks: 8 (limit: 1134)
    Memory: 23.7M
    CPU: 77ms
    CGroup: /system.slice/mosdns.service
    └─2911 /usr/bin/mosdns start --as-service -d /etc/mosdns -c /etc/mosdns/config.yaml

    Mar 06 13:38:18 singbox systemd[1]: Started mosdns.service - A DNS forwarder.
    Mar 06 13:38:18 singbox mosdns[2911]: 2025-03-06T13:38:18.741+0800 INFO starting service {"platform": "linux-systemd"}
    Mar 06 13:38:18 singbox mosdns[2911]: 2025-03-06T13:38:18.741+0800 INFO working directory changed {"path": "/etc/mosdns"}
    Mar 06 13:38:18 singbox mosdns[2911]: 2025-03-06T13:38:18.741+0800 INFO main config loaded {"file": "/etc/mosdns/config.yaml"}
    tt@mosdns:~$ cat /etc/mosdns/moslog.log
    2025-03-06T13:38:18.741+0800 INFO loading plugin {"tag": "cache", "type": "cache"}
    2025-03-06T13:38:18.742+0800 INFO loading plugin {"tag": "forward_local", "type": "forward"}
    2025-03-06T13:38:18.742+0800 INFO loading plugin {"tag": "forward_remote", "type": "forward"}
    2025-03-06T13:38:18.742+0800 INFO loading plugin {"tag": "cn_ip", "type": "ip_set"}
    2025-03-06T13:38:18.743+0800 INFO loading plugin {"tag": "lan_ip", "type": "ip_set"}
    2025-03-06T13:38:18.743+0800 INFO loading plugin {"tag": "direct_list", "type": "domain_set"}
    2025-03-06T13:38:18.781+0800 INFO loading plugin {"tag": "proxy_list", "type": "domain_set"}
    2025-03-06T13:38:18.796+0800 INFO loading plugin {"tag": "local_sequence", "type": "sequence"}
    2025-03-06T13:38:18.796+0800 INFO loading plugin {"tag": "remote_sequence", "type": "sequence"}
    2025-03-06T13:38:18.796+0800 INFO loading plugin {"tag": "fallback", "type": "fallback"}
    2025-03-06T13:38:18.796+0800 NFO loading plugin {"tag": "main_sequence", "type": "sequence"}
    2025-03-06T13:38:18.796+0800 INFO loading plugin {"tag": "udp_server", "type": "udp_server"}
    2025-03-06T13:38:18.796+0800 INFO udp_server udp server started {"addr": "[::]:53"}
    2025-03-06T13:38:18.796+0800 INFO loading plugin {"tag": "tcp_server", "type": "tcp_server"}
    2025-03-06T13:38:18.796+0800 INFO tcp_server tcp server started {"addr": "[::]:53", "tls": false}
    2025-03-06T13:38:18.796+0800 INFO all plugins are loaded
    ```
    wander555
        3
    wander555  
       218 天前
    @Vtoecha 没有成功调用吧,只是启动成功了
    zbatman
        4
    zbatman  
       218 天前
    mosdns 新版本的日志很少了,如果想看请求和响应内容,可以在配置里自己加
    - exec: debug_print 日志内容

    参考文档: https://irine-sistiana.gitbook.io/mosdns-wiki/mosdns-v5/ru-he-pei-zhi-mosdns/sequence-cha-jian#debug_print
    Vtoecha
        5
    Vtoecha  
    OP
       218 天前
    @wander555 那肯定成功了,我电脑 dns 服务器都指向 mosdns 了,解析也正常
    yianing
        6
    yianing  
       217 天前
    加日志插件,query_summary debug_print
    lx01xsz
        7
    lx01xsz  
       173 天前
    "无 debug log 正常。v5 删除了 v4 很多 debug log 已提升性能。"
    https://github.com/IrineSistiana/mosdns/issues/599#issuecomment-1411776223
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5382 人在线         Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 29ms UTC 06:44 PVG 14:44 LAX 23:44 JFK 02:44
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86