https://github.com/m-mizutani/spout
Lightweight structured log viewer for cloud services
https://github.com/m-mizutani/spout
go logging nextjs
Last synced: about 1 year ago
JSON representation
Lightweight structured log viewer for cloud services
- Host: GitHub
- URL: https://github.com/m-mizutani/spout
- Owner: m-mizutani
- License: apache-2.0
- Created: 2022-08-11T02:13:51.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-25T22:05:28.000Z (over 2 years ago)
- Last Synced: 2025-04-26T07:08:33.431Z (about 1 year ago)
- Topics: go, logging, nextjs
- Language: Go
- Homepage:
- Size: 508 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spout
`spout` is a lightweight log viewer for cloud service logs.

## Features
- Quick filtering by [jq](https://stedolan.github.io/jq/)
- Invoke from command line with pre-defined options
- Support multiple log sources
- Google Cloud Logging and JSON formatted local file for now
## Installation
### From releases
Download a binary for your platform from https://github.com/m-mizutani/spout/releases
### Build
`go install` can not be used to install because of requiring `npm`. You can build `spout` by following steps.
```sh
$ git clone https://github.com/m-mizutani/spout.git
$ cd spout
$ cd frontend && npm install && npm run export && cd ..
$ go build .
```
## Usage
### Google Cloud Logging
Example of command line:
```bash
$ spout gcp --project -d 10m --filter "resource.type=k8s_container"
```
Options:
```
--addr value, -a value Server address for browser mode (default: "127.0.0.1:3280") [$SPOUT_ADDR]
--base-time value, -t value Base time [$SPOUT_BASE_TIME]
--duration value, -d value Duration, e.g. 10m, 30s (default: "10m") [$SPOUT_DURATION]
--filter value, -f value Google Cloud Logging filter (accepts multiple inputs) [$SPOUT_GCP_FILTER]
--limit value Limit of fetching log (default: 1000) [$SPOUT_GCP_LIMIT]
--mode value, -m value Run mode [console|browser] (default: "browser") [$SPOUT_MODE]
--project value, -p value Google Cloud Project ID [$SPOUT_GCP_PROJECT]
--range value, -r value Range type [before|after|around] (default: "before") [$SPOUT_RANGE]
```
### Preset options
Save `.spout.toml` like following at **current working directory**.
```toml
[stg]
command = "gcp"
options = [
"--limit", "100",
"--project", "your-staging-service",
"--filter", 'resource.type=k8s_container labels."k8s-pod/services_ubie_app/app"="your_app"',
]
[prd]
command = "gcp"
options = [
"--limit", "100",
"--project", "your-production-service",
"--filter", 'resource.type=k8s_container labels."k8s-pod/services_ubie_app/app"="your_app"',
]
```
Then, you can call predefined options as following:
```bash
$ spout call prd # means 'gcp --limit 100 --project your-production-service ...'
$ spout call prd --filter "user_20352904853" # Append '--filter "user_20352904853"' to existing prd options
```
## License
Apache version 2.0