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

"There is no active user" when setting up Xray to write logs to files #32

Open
AlexKoup opened this issue Nov 20, 2023 · 6 comments
Open
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@AlexKoup
Copy link

I found a problem. If the xray_config.json file specifies saving logs to files like this:

   "log": {
     "loglevel": "info",
         "access": "/var/lib/marzban-node/access.log",
         "error": "/var/lib/marzban-node/error.log"
   },

then the script does not work, it displays "There is no active user".
Right while the script was running, I deleted and added back the access and error entries, restarted Xray and the script either worked or stopped.

@houshmand-2005
Copy link
Owner

hom this is odd, it shouldn't be a problem
maybe because of the config update there is a problem with getting the log from the panel. When you run script after saving the changes does the problem persist?
Anyway if this problem still exists I suggest you discuss this issue with Marzban, because getting logs from Xray core and sending logs is done by the panel.

@AlexKoup
Copy link
Author

AlexKoup commented Nov 21, 2023

Yes, the problem persists even after rebooting the server and restarting marzban. The xray logs themselves are created correctly. They contain user IPs and all other information. Marzban displays logs in the panel. Only V2IpLimit stops working. It continues to write log and send messages in telegram, but there is always “There is no active user”. As soon as I remove these lines from the Xray config, even without rebooting the kernel, V2IpLimit immediately, according to the timer, starts working correctly.
Because I write logs on all nodes, then in the marzban docker-compose.yml I have the following volume connected:

  • /var/lib/marzban/logs:/var/lib/marzban-node

@houshmand-2005
Copy link
Owner

I checked myself.
After change config(xray_config.json) like this

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

This is what Api and Panel shows (script receives logs like this):

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):

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

The xray logs themselves are created correctly. They contain user IPs and all other information. Marzban displays logs in the panel. @AlexKoup

And that's why I don't know how you can see the users' information inside the panel logs. Please check it again.
You probably see the logs before the core is restarted.


As I can understand when with Xray you 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.

This is my opinion, maybe I'm wrong :)

@houshmand-2005 houshmand-2005 added the question Further information is requested label Nov 22, 2023
@AlexKoup
Copy link
Author

It looks like it is. That is, writing logs to files and working with V2IpLimit are incompatible on marzban. Is it possible to force the script to read logs from xray files?

@GawrAme
Copy link

GawrAme commented Nov 24, 2023

i had the same issues here

@houshmand-2005
Copy link
Owner

@AlexKoup Not by default, but it can be changed.
But you know this isn't a good way because we can't support nodes in this way.
As a result, if Marzban finds a way to send logs in this mode (which is not easy because Xray itself has limitations for it), which is not a problem, otherwise it's not easy solve problem.

I will create an issue in Marzban to report it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants