md.stdout.cli
1.0.2
See the version list below for details.
dotnet tool install --global md.stdout.cli --version 1.0.2
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local md.stdout.cli --version 1.0.2
#tool dotnet:?package=md.stdout.cli&version=1.0.2
nuke :add-package md.stdout.cli --version 1.0.2
Std.Out
Captures output of a program to assist with debugging.
This project is tailored towards AWS services, and is not suitable for general purpose diagnostics.
Nuget
dotnet tool install --global md.stdout.cli
RUN
stdout verb [options]
Tracing
Pulls data from various sources, and displays them:
- CloudWatch: Gathers related messages across log streams, and groups.
- S3: Download assets files (WIP).
- DynamoDB: Load related records (WIP).
CLI
CloudWatch
stdout cw --key appname --cid b6408f5a-6893-4fb7-b996-3946371ab57f
--key: The name of the configuration in app settings, that defines the log groups to query, and general filter rules.
--cid: The Correlation Id to filter the logs by.
S3
stdout s3 --key appname --cid b6408f5a-6893-4fb7-b996-3946371ab57f
--key: The name of the configuration in app settings, that defines the bucket, and path prefix.
--cid: The Correlation Id is part of (or all) of the key, the target files are found under the prefix + correlation id.
DynamoDB
stdout db --key appname --pk b6408f5a-6893-4fb7-b996-3946371ab57f --sk 2022-01-01
--key: The name of the configuration in app settings, that defines the table name, and index to use.
--pk: The Partition Key for an item.
--sk: The Sort Key for an item. If not provided, all sks found under the pk are returned.
AppSettings
The appsettings.json
file is found at the tool's installed location.
- Windows:
%USERPROFILE%\.dotnet\tools
- macOS/Linux:
$HOME/.dotnet/tools
From there the relative apth is: .store\md.stdout.cli\{VERSION}\md.stdout.cli\{VERSION}\tools\{RUNTIME}\any
Where {VERSION}
is the installed package's version, i.e "1.0.2".
Where {RUNTIME}
is the installed package's runtime, i.e. "net8.0".
{
"CloudWatch": {
"Defaults": {
"Limit": "25",
"RelativeHours": "1",
"IsPresentFieldName": "isStructuredLog",
"CorrelationIdFieldName": "eventProperties.correlationId",
"Fields": [
"@timestamp",
"level",
"message"
],
"Filters": [
{
"Field": "level",
"Value": "INFO"
},
{
"Field": "eventProperties.customerId",
"Value": "12345678"
}
]
},
"Sources": {
"AppName": {
"LogGroups": [
"/aws/lambda/lambda-one",
"/aws/lambda/lambda-two"
]
},
"AnotherAppName": {
"LogGroups": [
"/aws/lambda/lambda-three"
],
"Filters": [
{
"Field": "level",
"Value": "ERROR"
}
]
}
}
}
}
CloudWatch
Defaults
are applied to all Sources
that don't override the property value with their own.
In this example AnotherAppName
overrides the Filters
value from Defaults
.
The "app names" under Sources
are matched to the --key
command line argument.
stdout cw --key appname --cid 3ee9222f-ed70-475f-8fdc-ee56d1f439da
If sensible defaults can be applied to all sources, then you would only need to set the LogGroups
for each logical "app".
Otherwise you can have custom settings for each app under Sources
.
LogGroups:
An array of log group names from AWS CloudWatch (required).Limit:
The maximum number of logs to return for a query (optional: 25).RelativeHours:
The number of hours to look backwards from "now" (optional: 1).IsPresentFieldName:
Selects logs with a particular field that must exist (optional: omitted from query).CorrelationIdFieldName:
The field name that contains an Id, that groups all logs together for a particular request (optional: omitted from query).Fields:
The CloudWatch fields to select from the query (optional: @timestamp, @message).Filters:
Clauses to add to the query, each filter will be in the form: "and key = value" (optional: omitted from query).
Credits
- Icon made by Vitaly Gorbachev from Flaticon
- Standard Out Visualization generated from chatgpt (DALL.E / OpenAI).
Changelog
1.0.0
- Created console app project, and readme file.
1.0.1
- Added diagnostics to determine why settings aren't loading.
1.0.2
- Removed diagnostics, fixed pathing issues to the settings file.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
This package has no dependencies.
First release of Std.Out, queries CloudWatch log groups though the console.