mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
feat(logs): 'uc machine logs' to view logs from systemd services on machines (#283)
* logging: client side Create internal/logs and put abstracted way service and machine logging in there This adds the bits to do machine logging of the services. See #273 and discussion in #158 Signed-off-by: Miek Gieben <miek@miek.nl> * go mod tidy Signed-off-by: Miek Gieben <miek@miek.nl> * fix typo Signed-off-by: Miek Gieben <miek@miek.nl> * Hook it up further Signed-off-by: Miek Gieben <miek@miek.nl> * Check unit validity server side Signed-off-by: Miek Gieben <miek@miek.nl> * Make cli-docs Signed-off-by: Miek Gieben <miek@miek.nl> * Add newline to logs Signed-off-by: Miek Gieben <miek@miek.nl> * docs Signed-off-by: Miek Gieben <miek@miek.nl> * Polish a bit Signed-off-by: Miek Gieben <miek@miek.nl> * comment fix Signed-off-by: Miek Gieben <miek@miek.nl> * There is no groupid Signed-off-by: Miek Gieben <miek@miek.nl> --------- Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -22,6 +22,7 @@ Manage machines in the cluster.
|
||||
* [uc](uc.md) - A CLI tool for managing Uncloud resources such as machines, services, and volumes.
|
||||
* [uc machine add](uc_machine_add.md) - Add a remote machine to a cluster.
|
||||
* [uc machine init](uc_machine_init.md) - Initialise a new cluster with a remote machine as the first member.
|
||||
* [uc machine logs](uc_machine_logs.md) - View systemd service logs.
|
||||
* [uc machine ls](uc_machine_ls.md) - List machines in a cluster.
|
||||
* [uc machine rename](uc_machine_rename.md) - Rename a machine in the cluster.
|
||||
* [uc machine rm](uc_machine_rm.md) - Remove a machine from a cluster and reset it.
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# uc machine logs
|
||||
|
||||
View systemd service logs.
|
||||
|
||||
## Synopsis
|
||||
|
||||
View logs from all replicas of the specified units(s) (uncloud, docker or uncloud-corrosion) across all machines in the cluster.
|
||||
|
||||
If no units are specified, streams logs from the uncloud unit.
|
||||
|
||||
```
|
||||
uc machine logs [UNIT...] [flags]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
# View recent logs for a system service.
|
||||
uc logs uncloud
|
||||
|
||||
# Stream logs in real-time (follow mode).
|
||||
uc logs -f uncloud
|
||||
|
||||
# View logs from multiple services.
|
||||
uc logs web uncloud docker
|
||||
|
||||
# View logs from uncloud
|
||||
uc logs
|
||||
|
||||
# Show last 20 lines per replica (default is 100).
|
||||
uc logs -n 20 docker
|
||||
|
||||
# Show all logs without line limit.
|
||||
uc logs -n all docker
|
||||
|
||||
# View logs from a specific time range.
|
||||
uc logs --since 3h --until 1h30m docker
|
||||
|
||||
# View logs only from replicas running on specific machines.
|
||||
uc logs -m machine1,machine2 docker corrosion
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```
|
||||
-f, --follow Continually stream new logs.
|
||||
-h, --help help for logs
|
||||
-m, --machine strings Filter logs by machine name or ID. Can be specified multiple times or as a comma-separated list.
|
||||
--since string Show logs generated on or after the given timestamp. Accepts relative duration, RFC 3339 date, or Unix timestamp.
|
||||
Examples:
|
||||
--since 2m30s Relative duration (2 minutes 30 seconds ago)
|
||||
--since 1h Relative duration (1 hour ago)
|
||||
--since 2025-11-24 RFC 3339 date only (midnight using local timezone)
|
||||
--since 2024-05-14T22:50:00 RFC 3339 date/time using local timezone
|
||||
--since 2024-01-31T10:30:00Z RFC 3339 date/time in UTC
|
||||
--since 1763953966 Unix timestamp (seconds since January 1, 1970)
|
||||
-n, --tail string Show the most recent logs and limit the number of lines shown per replica. Use 'all' to show all logs. (default "100")
|
||||
--until string Show logs generated before the given timestamp. Accepts relative duration, RFC 3339 date, or Unix timestamp.
|
||||
See --since for examples.
|
||||
--utc Print timestamps in UTC instead of local timezone.
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
```
|
||||
--connect string Connect to a remote cluster machine without using the Uncloud configuration file. [$UNCLOUD_CONNECT]
|
||||
Format: [ssh://]user@host[:port], ssh+go://user@host[:port], tcp://host:port, or unix:///path/to/uncloud.sock
|
||||
-c, --context string Name of the cluster context to use (default is the current context). [$UNCLOUD_CONTEXT]
|
||||
--uncloud-config string Path to the Uncloud configuration file. [$UNCLOUD_CONFIG] (default "~/.config/uncloud/config.yaml")
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
* [uc machine](uc_machine.md) - Manage machines in the cluster.
|
||||
|
||||
Reference in New Issue
Block a user