md.stdout.cli 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global md.stdout.cli --version 1.0.3                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local md.stdout.cli --version 1.0.3                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=md.stdout.cli&version=1.0.3                
nuke :add-package md.stdout.cli --version 1.0.3                

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.

Console Standard Out Visualization

Nuget

.NET CLI

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.
  • 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, that target files are found under the prefix, and 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: %USERPROFILE%\.dotnet\tools
From there the relative path 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"
          }
        ]
      }
    }
  },
  "S3": {
    "Defaults": {
      "ContentType": "json",
      "BrowserDisplay": "chrome"
    },
    "Sources": {
      "AppName": {
        "Bucket": "bucketName",
        "Prefix": "assets/text/<CID>/"
      }
    }
  }
}

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).

S3

Defaults are applied to all Sources that don't override the property value with their own.
In this example AppName inherits the ContentType, and BrowserDisplay values from Defaults.
The "app names" under Sources are matched to the --key command line argument.

stdout s3 --key appname --cid 3ee9222f-ed70-475f-8fdc-ee56d1f439da
  • Bucket: The S3 buckname name, where your logging / debugging output files are stored (required).
  • Prefix: The key path where your files for a particular request can be found under. The Correlation Id from the command line is merged with <CID> (required).
  • ContentType: The expected file contents, used for pretty printing / formatting; only json and the raw contents are supported for now (optional).
  • BrowserDisplay: The preferred browser to open when displaying the file contents; only chrome and firefox on windows are supported for now (required).

Credits

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.

1.0.3

  • Added support for downloading S3 files, and displaying their contents in the browser.
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2.0.0 68 2/22/2025
1.0.3 74 2/16/2025
1.0.2 70 2/15/2025
1.0.1 76 2/15/2025
1.0.0 68 2/15/2025

First release of Std.Out, queries CloudWatch log groups though the console.