miralog
v1.0.1
Published
a JSON log parsing tool for Ruckus cloud services
Downloads
4
Maintainers
Readme
A customized JSON log parser for Ruckus Alto services logs.
Installation
Install NodeJs and NPM
Please follow the link below to install nodeJS and npm on your machine link
Install miralog
sudo npm install -g miralog
Usage
Ruckus cloud alto services output log is a stream of JSON objects. This is great for machine processing,
but not friendly for reading by humans. A miralog
tool is provided for
transform output and for filtering.
To view the container logs in GKE, you can pipe the log to the 'miralog' command
$ kubectl -n dev logs wifi-broker-master--87-dd76ff99c-2p874 -c wifi-broker | miralog
Or you can save the file locally first, then view the log using 'miralog'
$ kubectl -n dev logs wifi-broker-master--87-dd76ff99c-2p874 -c wifi-broker > tmp.log
$ miralog tmp.log
The complete help on the usage of 'miralog' can be find by
$ miralog --help
Usage:
miralog [OPTIONS] [FILE ...]
... | miralog [OPTIONS]
Filter and pretty-print Ruckus Alto log file content.
General options:
-h, --help print this help info and exit
--version print version of this command and exit
Filtering options:
-s, --severity LEVEL
Only show messages at or above the specified severity.
-c, --condition CONDITION
Run each log message through the condition and
only show those that return truish. E.g.:
-c 'this.thread == "main"'
-c 'this.severity == "DEBUG"'
-c 'this.message.indexOf("boom") != -1'
"CONDITION" must be legal JS code. `this` holds the log record.
--strict Suppress all but legal Alto JSON log lines. By default
non-JSON, and non-Alto lines are passed through.
Output options:
--pager Pipe output into `less` (or $PAGER if set), if
stdout is a TTY. This overrides $MIRALOG_NO_PAGER.
Note: Paging is only supported on node >=0.8 and miralog [OPTIONS] [FILE ...] usage.
--no-pager Do not pipe output into a pager.
--color Colorize output. Defaults to try if output
stream is a TTY.
--no-color Force no coloring (e.g. terminal doesn't support it)
-o, --output MODE
Specify an output mode/format. One of
long: (the default) pretty
json: JSON output, 2-space indent
json-N: JSON output, N-space indent, e.g. "json-4"
inspect: node.js `util.inspect` output
short: like "long", but more concise
simple: severity, followed by "-" and then the message
-j shortcut for `-o json`
-0 shortcut for `-o miralog`
Environment Variables:
MIRALOG_NO_COLOR Set to a non-empty value to force no output
coloring. See "--no-color".
MIRALOG_NO_PAGER Disable piping output to a pager.
See "--no-pager".
Versioning
All versions are <major>.<minor>.<patch>
which will be incremented for
breaking backward compat and major reworks, new features without breaking
change, and bug fixes, respectively. tl;dr: Semantic
versioning.
Acknowledgments
This tool is based on bunyan CLI tool at https://github.com/trentm/node-bunyan.