Coder Social home page Coder Social logo

danhalford / sanxlog Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 50 KB

PowerShell logging library - supports file, console and multiple cloud log aggregators

License: MIT License

PowerShell 100.00%
datadog influxdb logging-library loggly powershell sumologic

sanxlog's Introduction

SanxLog - PowerShell Logging Module

SanxLog is a PowerShell Core module that enables simple logging to file and to a growing number of time-series databases and log aggregation services; currently InfluxDB, Datadog, Sumo Logic, Loggly and Elasticsearch. For each option, simultaneous logging to console is also supported.

Once the module has been imported, use the Set-Log cmdlet to specify the logging target. At present, you can only log to one location at a time. Each log target also supports, if required, logging to the Console. Once the log type has been specified, to write log entries, simply call: Write-LogCritical Write-LogError Write-LogWarn Write-LogInfo Write-LogDebug

Logging settings

All logging parameters are set using the Set-Log cmdlet. Specific options to note include:

  • -LogType - Mandatory option. Must be one of File, InfluxDB, Datadog, SumoLogic or Loggly
  • -LogLevel - Mandatory option. Specifies the minimum log level to write to the specified log target. Log entries with a lower level are ignored. Must be one of CRIT, ERROR, WARN, INFO and DEBUG.
  • -DisplayLevel - Specifies the minimum log level to write to the console. Log entries with a lower level are ignored. Must be one of CRIT, ERROR, WARN, INFO and DEBUG, or NONE to disable console logging entirely. If not specifed, defaults to the -LogLevel value.

File logging

Features include:

  • Log to any locally accessible path; local disk or UNC paths supported.
  • Configurable maximum log size, with automatic rollover
  • Timestamps can be local time or UTC

Log file format

The log files are written in a human-readable (or at least, human parseable) format:

[Timestamp] [ProcessID] [Log level - CRIT|ERROR|WARN|INFO|DEBUG] Message

InfluxDB logging

Features include:

  • Supports InfluxDB on-premises and InfluxDB Cloud - InfluxDB v2.x currently supported and v3.x coming soon
  • Organisation name and bucket fully customiable with names and IDs supported
  • Entries tagged with a Source, LogLevel, Hostname and ProcessID tags for easy filtering

Datadog logging

Features include:

  • Service fully configurable
  • Source and LogLevel included as log entry tags. Additional tags can be specified.

Log messages are written in the following format:

[Log level - CRIT|ERROR|WARN|INFO|DEBUG] [ProcessID] Message

Loggly logging

Features include:

  • Log messages written as JSON to take advantage of Loggly's excellent filtering and searching functions
  • Each message tagged with Hostname, LogLevel, ProcessID and a configurable Source and Service
  • Tags are also supported.

Sumo Logic logging

To ingest logs into Sumo Logic, you first need to create an collector and then create a HTTP Logs & Metrics source. During the source creation process, be sure to select the One Message Per Request option, otherwise the JSON log entries are processed as individual lines. Once it's created, use the source URL as the ServerURL parameter. Features include:

  • Log messages written as JSON to take advantage of Loggly's excellent filtering and searching functions
  • Each message tagged with Hostname, LogLevel, ProcessID and a configurable Source and Service
  • Additional metadata tags can be specified as key/value pairs

Elasticsearch logging

To ingest logs into Elastic search, you first need to have created an index to receive them. Features include:

  • Log messages written as JSON to take advantage of filtering and searching functions
  • Each message tagged with Hostname, LogLevel, ProcessID and a configurable Source and Service
  • Tags are also supported. Use the Set-Log -SkipCertificateCheck option to turn off SSL certificate checking if testing against a development instance.

sanxlog's People

Contributors

danhalford avatar

Watchers

 avatar

Forkers

sbthofra

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.