osc-logs constantly fetch API call logs from Outscale to easily consult and keep them.
osc-logs fetch API call logs every few seconds and only print logs from program's start date.
By default logs are printed as Line-delimited JSON to standard output. See format documentation for more details.
We recommend using jq utility for additional filtering and formating.
osc-logs
Options:
-w, --write Write all traces inside a file instead of writing to standard output
-c, --count Exit after <count> logs
-i, --interval Wait a duration defined by <wait> (in seconds) between two calls to Outscale API (default: 10)
-p, --profile Use a specific profile name ("default" is the default profile )
-I, --ignore Ignore one or more specific API calls. Values are separated by commas e.g. "--ignore=ReadApiLogs,ReadVms"
-v, --version Print version to standard output and exit
Download latest binary in Release page.
Alternatively, you can run (or update) osc-logs with this command:
go install github.com/outscale/osc-logs@latest
osc-logs reads ~/.osc/config.json
file to get its credentials and region details.
Example of config.json
:
{
"default": {
"access_key": "MyAccessKey",
"secret_key": "MySecretKey",
"region": "eu-west-2"
}
}
Example of storing all logs in a file except ReadApiLogs call itself:
osc-logs --ignore=ReadApiLogs -w logs.json
Once logs are recording to logs.json
, you can separatly work on them.
You can live-view them using tail -f logs.json
or use more advanced tools like jq to query json documents.
Example of showing only calls date, name and status code with tab-separated values:
jq -s -r '(.[] | [.QueryDate, .QueryCallName, .ResponseStatusCode]) | @tsv' logs.json
2022-06-17T12:14:28.378111Z ReadVolumes 200
2022-06-17T12:14:28.378111Z ReadVolumes 200
2022-06-17T12:14:30.379899Z CreateVms 200
Copyright Outscale SAS BSD-3-Clause
Check CONTRIBUTING.md for more details about license testing.