2019-06-15 23:07:46 +00:00
|
|
|
# SALTY DOG
|
|
|
|
|
2019-06-15 23:33:50 +00:00
|
|
|
JSON **s**chema **a**nalysis, **l**inting, and **t**ransformation for **Y**AML, featuring **d**efaults, **o**ptional
|
|
|
|
fields, and other **g**ood stuff.
|
2019-06-15 23:07:46 +00:00
|
|
|
|
|
|
|
- [SALTY DOG](#salty-dog)
|
|
|
|
- [Build](#build)
|
|
|
|
- [Usage](#usage)
|
|
|
|
- [Options](#options)
|
2019-06-15 23:36:44 +00:00
|
|
|
- [Count](#count)
|
2019-06-15 23:07:46 +00:00
|
|
|
- [Exclude Level](#exclude-level)
|
|
|
|
- [Exclude Name](#exclude-name)
|
|
|
|
- [Exclude Tag](#exclude-tag)
|
|
|
|
- [Include Level](#include-level)
|
|
|
|
- [Include Name](#include-name)
|
|
|
|
- [Include Tag](#include-tag)
|
|
|
|
- [Mode](#mode)
|
|
|
|
- [Rules](#rules)
|
|
|
|
- [Source](#source)
|
|
|
|
|
|
|
|
## Build
|
|
|
|
|
|
|
|
```shell
|
2019-06-15 23:33:50 +00:00
|
|
|
> git clone git@github.com:ssube/salty-dog.git
|
|
|
|
> make
|
2019-06-15 23:07:46 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```shell
|
2019-06-15 23:56:42 +00:00
|
|
|
> cat rules/examples/kubernetes-require-resources-fail.yml |\
|
|
|
|
salty-dog \
|
|
|
|
--rules rules/kubernetes.yml \
|
|
|
|
--source - \
|
|
|
|
--tag important |\
|
|
|
|
./node_modules/.bin/bunyan
|
|
|
|
|
|
|
|
[2019-06-15T23:56:04.764Z] ERROR: salty-dog/22211 on cerberus: some rules failed (errors=1)
|
|
|
|
|
|
|
|
> cat rules/examples/kubernetes-require-resources-pass.yml |\
|
|
|
|
salty-dog \
|
|
|
|
--rules rules/kubernetes.yml \
|
|
|
|
--source - \
|
|
|
|
--tag important |\
|
|
|
|
./node_modules/.bin/bunyan
|
|
|
|
|
|
|
|
[2019-06-15T23:53:34.223Z] INFO: salty-dog/19839 on cerberus: all rules passed
|
2019-06-15 23:07:46 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
|
|
|
|
Excludes take priority over includes: a rule matching some of both will be excluded.
|
|
|
|
|
2019-06-15 23:36:44 +00:00
|
|
|
#### Count
|
|
|
|
|
|
|
|
- Alias: `c`
|
|
|
|
|
|
|
|
Exit with the error count (max of 255) rather than `0` or `1`.
|
|
|
|
|
2019-06-15 23:07:46 +00:00
|
|
|
#### Exclude Level
|
|
|
|
|
|
|
|
Exclude rules by log level.
|
|
|
|
|
|
|
|
#### Exclude Name
|
|
|
|
|
|
|
|
Exclude rules by name.
|
|
|
|
|
|
|
|
#### Exclude Tag
|
|
|
|
|
|
|
|
Exclude rules by tag.
|
|
|
|
|
|
|
|
#### Include Level
|
|
|
|
|
|
|
|
Include rules by log level.
|
|
|
|
|
|
|
|
#### Include Name
|
|
|
|
|
|
|
|
Include rules by name.
|
|
|
|
|
|
|
|
#### Include Tag
|
|
|
|
|
|
|
|
- Alias: `t`, `tag`
|
|
|
|
|
|
|
|
Include rules by tag.
|
|
|
|
|
|
|
|
#### Mode
|
|
|
|
|
|
|
|
- Alias: `m`
|
|
|
|
- Default: `check`
|
|
|
|
|
|
|
|
The application mode.
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
|
|
|
- `check` runs each rule and exits with an indicative status
|
|
|
|
- `clean` runs each rule and updates the source data with any defaults or other changes before running the next rule
|
|
|
|
|
|
|
|
#### Rules
|
|
|
|
|
|
|
|
The path to a file containing some `rules`.
|
|
|
|
|
|
|
|
#### Source
|
|
|
|
|
|
|
|
- Alias: `s`
|
|
|
|
- Default: `-`
|
|
|
|
|
|
|
|
The source file to validate.
|
|
|
|
|
|
|
|
Defaults to stdin (`-`) to work with pipes: `cat file.yml | salty --source -`
|