mirror of
https://github.com/logos-storage/logos-storage-docs.git
synced 2026-01-07 15:53:13 +00:00
docs: log into a separate logfile when run as a service in linux
This commit is contained in:
parent
9b03f04c05
commit
2d7da05be7
26
learn/run.md
26
learn/run.md
@ -428,6 +428,7 @@ We can run Codex as a service via [systemd](https://systemd.io) using following
|
|||||||
3. Create directories
|
3. Create directories
|
||||||
```shell
|
```shell
|
||||||
sudo mkdir -p /opt/codex/data
|
sudo mkdir -p /opt/codex/data
|
||||||
|
sudo mkdir -p /opt/codex/logs
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Create a configuration file
|
4. Create a configuration file
|
||||||
@ -481,6 +482,8 @@ We can run Codex as a service via [systemd](https://systemd.io) using following
|
|||||||
ExecStart=/usr/local/bin/codex --config-file="/opt/codex/codex.conf"
|
ExecStart=/usr/local/bin/codex --config-file="/opt/codex/codex.conf"
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
StandardOutput=append:/opt/codex/logs/codex.log
|
||||||
|
StandardError=append:/opt/codex/logs/codex.log
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
@ -498,11 +501,26 @@ We can run Codex as a service via [systemd](https://systemd.io) using following
|
|||||||
sudo systemctl status codex
|
sudo systemctl status codex
|
||||||
```
|
```
|
||||||
|
|
||||||
9. Check the logs
|
9. Enable logs rotation using logrotate
|
||||||
```shell
|
```shell
|
||||||
sudo journalctl -u codex -S "5min ago"
|
sudo vi /etc/logrotate.d/codex
|
||||||
sudo journalctl -f -u codex
|
```
|
||||||
sudo tail -f /var/log/syslog | grep codex
|
```logrotate
|
||||||
|
/opt/codex/logs/*.log {
|
||||||
|
daily
|
||||||
|
missingok
|
||||||
|
rotate 5
|
||||||
|
copytruncate
|
||||||
|
nocreate
|
||||||
|
nomail
|
||||||
|
dateext
|
||||||
|
dateyesterday
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Check the logs
|
||||||
|
```shell
|
||||||
|
tail -f /opt/codex/logs/codex.log
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run as a service in Windows
|
### Run as a service in Windows
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user