Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/outscale/osc-logs
osc-logs
https://github.com/outscale/osc-logs
Last synced: 7 days ago
JSON representation
osc-logs
- Host: GitHub
- URL: https://github.com/outscale/osc-logs
- Owner: outscale
- Created: 2022-05-10T07:30:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-23T14:38:23.000Z (over 1 year ago)
- Last Synced: 2024-06-19T15:16:40.237Z (5 months ago)
- Language: Go
- Homepage:
- Size: 45.9 KB
- Stars: 3
- Watchers: 5
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSES/BSD-3-Clause.txt
Awesome Lists containing this project
README
[![Project Incubating](https://docs.outscale.com/fr/userguide/_images/Project-Incubating-blue.svg)](https://docs.outscale.com/en/userguide/Open-Source-Projects.html)
# osc-logs
osc-logs constantly fetch API call logs from Outscale to easily consult and keep them.
# Features
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](https://docs.outscale.com/api#tocslog) for more details.
We recommend using [jq](https://stedolan.github.io/jq/) utility for additional filtering and formating.
```
osc-logsOptions:
-w, --write Write all traces inside a file instead of writing to standard output
-c, --count Exit after logs
-i, --interval Wait a duration defined by (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
```# Installation
Download latest binary in [Release page](https://github.com/outscale/osc-logs/releases).
Alternatively, you can run (or update) osc-logs with this command:
```
go install github.com/outscale/osc-logs@latest
```# Configuration
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"
}
}
```# Usage example
Example of storing all logs in a file except [ReadApiLogs](https://docs.outscale.com/api#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](https://stedolan.github.io/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
```# License
> Copyright Outscale SAS
> BSD-3-ClauseCheck [CONTRIBUTING.md](CONTRIBUTING.md) for more details about license testing.