spout

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

README

spout

spout is a lightweight log viewer for cloud service logs.

spout

Features

  • Quick filtering by 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.

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

$ spout gcp --project <your-project-id> -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.

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

$ 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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL