All Projects → eth0izzle → NLog.Slack

eth0izzle / NLog.Slack

Licence: MIT license
An NLog target for Slack - your logs in one place and instantly searchable, everywhere.

Programming Languages

C#
18002 projects

Labels

Projects that are alternatives of or similar to NLog.Slack

openwhisk-slackapp
A serverless Slack app built with Slack Events API and IBM Cloud Functions
Stars: ✭ 24 (-47.83%)
Mutual labels:  slack
git-slack-notify
Sends Slack notifications for new commits in Git repositories
Stars: ✭ 12 (-73.91%)
Mutual labels:  slack
CWSlack-SlashCommands
Retrieve ConnectWise information into Slack channels and DMs
Stars: ✭ 54 (+17.39%)
Mutual labels:  slack
slatify
Slack Notification for GitHub Actions 🔔
Stars: ✭ 132 (+186.96%)
Mutual labels:  slack
zoom-slack-status-updater
Update your Slack status automatically when you join a Zoom meeting.
Stars: ✭ 23 (-50%)
Mutual labels:  slack
oauth2-slack
Slack OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Stars: ✭ 20 (-56.52%)
Mutual labels:  slack
kwatchman
Watch for k8s resources changes and trigger chains of handlers
Stars: ✭ 24 (-47.83%)
Mutual labels:  slack
setup-linux-debian
Installs essential JavaScript development programs.
Stars: ✭ 16 (-65.22%)
Mutual labels:  slack
worldcup-slack-bot
WorldCupBot will notify a Slack channel/group for every match during a FIFA World Cup
Stars: ✭ 33 (-28.26%)
Mutual labels:  slack
bitbot
Bitbot: Rack based Slack bot with a responder DSL and support for Wit.ai natural language processing.
Stars: ✭ 13 (-71.74%)
Mutual labels:  slack
rota-slackbot
Slackbot that helps manage rotations.
Stars: ✭ 50 (+8.7%)
Mutual labels:  slack
SlackLateX
Bot that posts posts Latex pictures
Stars: ✭ 39 (-15.22%)
Mutual labels:  slack
magento2-module-slack
Magento 2 Module to send Notifications to a Slack Channel via Webhook.
Stars: ✭ 14 (-69.57%)
Mutual labels:  slack
pr-reviews-reminder-action
A GitHub Action to send Slack/Teams notification for Pull Request that are waiting for reviewers.
Stars: ✭ 18 (-60.87%)
Mutual labels:  slack
logging
💥 Universal logging support to Tracy / Nette Framework (@nette)
Stars: ✭ 18 (-60.87%)
Mutual labels:  slack
slack-discord-bridge
Bridges a text channel between Slack and Discord
Stars: ✭ 21 (-54.35%)
Mutual labels:  slack
slacky-dark
Dark mode theme for Slack desktop clients
Stars: ✭ 24 (-47.83%)
Mutual labels:  slack
hubot-code-review
A Hubot script for GitHub code review on Slack.
Stars: ✭ 38 (-17.39%)
Mutual labels:  slack
website
PySlackers website for invites and learning resources
Stars: ✭ 61 (+32.61%)
Mutual labels:  slack
slack-to-opsgenie-alert-creator
Create alerts from messages sent to a Slack channel
Stars: ✭ 25 (-45.65%)
Mutual labels:  slack

NLog.Slack

Nuget

An NLog target for Slack - your logs in one place and instantly searchable, everywhere.

NLog.Slack

Note: it is no longer possible to pass in a custom channel, username or icon. This must be defined by your Slack App.

Installation

Via NuGet: Install-Package NLog.Slack

... or just build it your self!

Usage

  1. Create a new Slack App in the correct Workspace.
  2. Add the Incoming Webhooks functionality to your App.
  3. Generate a new Webhook URL and Authorize it to post to a channel.
  4. Copy your Webhook URL and configure NLog via your NLog.config file or programmatically, as below.

NLog.config

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <extensions>
    <add assembly="NLog.Slack" />
  </extensions>

  <targets async="true">
    <target xsi:type="Slack"
            name="slackTarget"
            layout="${message}"
            webHookUrl="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
            compact="false">

			<field name="Machine Name" layout="${machinename}" />
			<field name="Process Name" layout="${processname}" />
			<field name="Process PID" layout="${processid}" />
	</target>
  </targets>

  <rules>
    <logger name="*" minlevel="Debug" writeTo="slackTarget" />
  </rules>
</nlog>

Note: it's recommended to set async="true" on targets so if the HTTP call to Slack fails or times out it doesn't slow down your application.

Programmatically

var config = new LoggingConfiguration();
var slackTarget = new SlackTarget
{
      Layout = "${message}",
      WebHookUrl = "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
};

config.AddTarget("slack", slackTarget);

var slackTargetRules = new LoggingRule("*", LogLevel.Debug, slackTarget);
config.LoggingRules.Add(slackTargetRules);

LogManager.Configuration = config;

And you're good to go!

Configuration Options

Key Description
WebHookUrl Grab your Webhook URL (with the token) from your Incoming Webhooks integration in Slack
Compact Set to true to just send the NLog layout text (no process info, colors, etc)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].