https://github.com/logicmonitor/nlog-target-logicmonitor
NLOG.Target.LogicMonitor
https://github.com/logicmonitor/nlog-target-logicmonitor
Last synced: 11 months ago
JSON representation
NLOG.Target.LogicMonitor
- Host: GitHub
- URL: https://github.com/logicmonitor/nlog-target-logicmonitor
- Owner: logicmonitor
- License: mpl-2.0
- Created: 2023-01-09T05:01:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-16T09:10:05.000Z (about 3 years ago)
- Last Synced: 2025-05-22T03:38:18.980Z (about 1 year ago)
- Language: C#
- Size: 9.77 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NLog.Targets.LogicMonitor
A NLog Target that send events and logs directly to LogicMonitor platform.
This Package leverages LogicMonitor.DataSDK to send logs.
Export the following environment variable.
System property | Environment variable | Description |
|----------|-------------|:------|
| `Configration.company` | `LM_COMPANY` | Account name (Company Name) is your organization name |
| `Configration.AccessID` | `LM_ACCESS_ID` | Access id while using LMv1 authentication. (Not needed while using Bearer API ) |
| `Configration.AccessKey` | `LM_ACCESS_KEY` | Access key while using LMv1 authentication. (Not needed while using Bearer API ) |
```csharp
var logger = NLog.LogManager.GetCurrentClassLogger();
var config = new NLog.Config.LoggingConfiguration();
// Targets where to log to: Console
var logMonitor = new NLog.Targets.LogicMonitor.LogicMonitorTarget();
// Rules for mapping loggers to targets
config.AddRule(LogLevel.Info, LogLevel.Error, logMonitor);
// Apply config
NLog.LogManager.Configuration = config;
```
or
:point_right: Learn more about [NLog Config](https://github.com/nlog/nlog/wiki/Configuration-file)
```csharp
//Note.: Add a NLog.Config.xml to your project.
var logger = NLog.LogManager.Setup().LoadConfigurationFromXml("Nlog.Config").GetCurrentClassLogger();
```