Gozargah / Marzban

Unified GUI Censorship Resistant Solution Powered by Xray
https://t.me/gozargah_marzban
GNU Affero General Public License v3.0
2.73k stars 395 forks source link

Problem with getting logs from Xray core When we save logs #672

Open houshmand-2005 opened 7 months ago

houshmand-2005 commented 7 months ago

Hi, The problem is that when we save logs, logs are no longer displayed in the panel and API


After change config(xray_config.json) like this

"log": {
    "loglevel": "info",
    "access": "access.log",
    "error": "error.log"
  },

This is what Api and Panel shows:

Xray 1.8.4 (Xray, Penetrates Everything.) Custom (go1.21.0 linux/amd64)

A unified platform for anti-censorship.
2023/11/22 16:59:16 [Info] infra/conf/serial: Reading config: stdin:

And this is the contents of access.log file (this is right and ok):

2023/11/22 17:01:32 192.168.1.33:11421 accepted tcp192.168.1.36:443 [VLESS_INBOUND -> proxy] email: 1.Test
2023/11/22 17:01:36 192.168.1.33:11424 accepted tcp192.168.1.36:443 [VLESS_INBOUND -> proxy] email: 1.Test
2023/11/22 17:01:37 192.168.1.33:11430 accepted tcp192.168.1.36:443 [VLESS_INBOUND -> proxy] email: 1.Test

As I can understand when with Xray we save the logs Xray doesn't show them on stdout, so marzban can't catch them. This is Marzban code to get logs:

    ...
    def capture_only():
        while self.process:
            output = self.process.stdout.readline()
            if output:
                output = output.strip()
                ...

so marzban just read the stdout and when Xray is saving log file, it doesn't send logs into stdout.

I found this out when someone reported it in my script https://github.com/houshmand-2005/V2IpLimit/issues/32

And if we remove the save location to just show the logs like this:

"log": {
    "loglevel": "info"
  },

Again the logs are sent without any problem.


Do you think something can be done for this?

omid-sadeghi commented 1 month ago

با سلام این رفتار پنل مرزبان که وقتی لاگ رو در فایل ذخیره می‌کنیم، دیگه لاگ نشون نمیده باعث میشه که اسکریپت V2IpLimit از کار بیفته چون این اسکریپت از لاگ‌های پنل مرزبان برای شمردن تعداد آیپی‌های هر کاربر استفاده میکنه.