mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #3276] 使用systemctl运行frps时,不会根据frps的.ini配置文件在log_file下输出日志。frpc同样如此。 #2625
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#2625
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JasonJarvan on GitHub (Jan 28, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3276
Bug Description
当我使用systemctl 运行 frp时,
frpc Version
0.46.1
frps Version
0.46.0
System Architecture
服务端和客户端都是Linux
Configurations
因为我猜测frps 和 frpc不输出日志的原因相同,所以我先给出frps的配置。如果frpc的配置也需要,可以在后面要求。
[common] bind_addr = 0.0.0.0 bind_port = 10086 tls_enable = true kcp_bind_port = 10086 bind_udp_port = 10087 vhost_http_port = 80 vhost_http_port = 8080 vhost_https_port = 443 log_file = ./frps.log log_level = info log_max_days = 3 max_pool_count = 50 tcp_mux = true`
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
ExecStart=/usr/local/frps/frps -c /usr/local/frps/frps.ini
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
StandardOutput=syslog
StandardError=inherit
[Install]
WantedBy=multi-user.target
`
然后执行systemctl enable frps
systemctl start frps
systemctl status frps,
在status 的输出中没有frps运行时日志,只有守护进程的日志。在log_file指定的目录下不会输出frps.log 。journalctl -u frps的输出也是一样。
`● frps.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/frps.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2023-01-28 21:28:10 CST; 4s ago
Main PID: 24939 (frps)
CGroup: /system.slice/frps.service
└─24939 /usr/local/frps/frps -c /usr/local/frps/frps.ini
Jan 28 21:28:10 VM-12-3-centos systemd[1]: Started The nginx HTTP and reverse proxy server`
但是,我关闭systemctl 的frps,仅通过
./frps -C ./frps.ini命令跑frps,是能正常输出日志的,日志如下:2023/01/28 21:27:00 [I] [tcp.go:64] [1e09032279b617c3] [ssh] tcp proxy listen port [55522] 2023/01/28 21:27:00 [I] [control.go:464] [1e09032279b617c3] new proxy [ssh] type [tcp] success 2023/01/28 21:27:00 [I] [control.go:464] [1e09032279b617c3] new proxy [p2p_ssh] type [xtcp] success 2023/01/28 21:27:00 [I] [http.go:93] [1e09032279b617c3] [web] http proxy listen for host [cdn.74a.cn] location [/clash] group [], routeByHTTPUser [] 2023/01/28 21:27:00 [I] [control.go:464] [1e09032279b617c3] new proxy [web] type [http] successLogs
No response
Steps to reproduce
...
Affected area
@Becods commented on GitHub (Jan 28, 2023):
frpc.conf 中的路径要使用绝对路径
或者 systemd 加上
WorkingDirectory@JasonJarvan commented on GitHub (Jan 28, 2023):
@Becods frpc.conf是指frps.ini吗?
这里是指frps.service文件中加WorkingDirectory吗?
@Becods commented on GitHub (Jan 28, 2023):
或者
@JasonJarvan commented on GitHub (Jan 28, 2023):
@Becods 感谢!第一种方法有效!
第二种我也在客户端试了,我保留了frpc.ini中的log_file=./frpc.log, 并在 systemd 加上WorkingDirectory。但是
sudo systemctl restart frpc后提示:我尝试过了sudo chmod 700 frpc,给frpc赋权。但是无效。请问怎么解决?
我刚刚用sudo chmod 666 frpc.log 将frpc.log文件降权,就OK了。谢谢你!
@ylluminate commented on GitHub (Feb 1, 2023):
Have tried both methods, but unfortunately neither work out. I still continue to get:
Ideally I'd like to get the log to be in the
/opt/frp/frp_current/path, but this is a tough nut to crack here.Can we get a more specific example of working settings for both the
frps.iniand the/usr/lib/systemd/system/frps.servicefile for Ubuntu 22.04?@JasonJarvan commented on GitHub (Feb 13, 2023):
Since the error is read-only file system, I guess the reason is you have set the .log file read-only.
@ylluminate commented on GitHub (Feb 13, 2023):
In this situation the filesystem is not read-only, but rather I suspect a problem with initiation/execution of the program by a user that does not have permission to the folder. The problem is that even when I attempt to execute this as
rootfor diagnostics, I still am being told the same thing - which is nonsensical. It appears that some additional debugging/logging of the logging facilitate needs to be put into place by @fatedier on their "BeeLogger" library.Also, @fatedier I would highly suggest changing the "Bee" naming of this since it is attached to spyware and was alarming while initially trying to do research on it.
@cvpas commented on GitHub (Mar 29, 2023):
日志文件路径写/var/log/frp.log试试,另外systemd service文件中不要写user这一行。