Ogamat.AuditProvider 1.0.0

dotnet add package Ogamat.AuditProvider --version 1.0.0
NuGet\Install-Package Ogamat.AuditProvider -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ogamat.AuditProvider" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ogamat.AuditProvider --version 1.0.0
#r "nuget: Ogamat.AuditProvider, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ogamat.AuditProvider as a Cake Addin
#addin nuget:?package=Ogamat.AuditProvider&version=1.0.0

// Install Ogamat.AuditProvider as a Cake Tool
#tool nuget:?package=Ogamat.AuditProvider&version=1.0.0

Ogamat.AuditProvider

.Net audit provider for managing and logging into windows event logs (security log, application log)

Nuget

Nuget Ogamat.AuditProvider

How-to:

Write your own implementation of Ogamat.AuditProvider.AuditProvider class. You need to provide

Policy = your own implementation of Ogamat.AuditProvider.AuditPolicy to allow logging specific event ids

EventLogName = string, name of the event log

LogLocation = enum (application log or security log)

Add methods for logging specififc events. Example:

    public class SampleProvider : AuditProvider
    {
        public SampleProvider(SamplePolicy policy)
            : base(policy, "SampleAppEventLog", LogLocation.SecurityLog)
        {
        }

        public void AuditApplicationInitialization(Guid instanceId)
        {
            ReportAudit(1, true, instanceId);
        }

        public void AuditApplicationTermination(Guid instanceId)
        {
            ReportAudit(2, true, instanceId);
        }
    }

Security event source registration:

    EventSourceInstaller.InstallSecurityEventSource(
                    EventLogName,
                    null,
                    null,
                    null,                    
                    Assembly.GetEntryAssembly().Location,
                    false);

You need to set special policies to use security event log (use secpol.msc Microsoft Management Console):

Local Policies / Audit Policy / Audit object access = Success, Failure 
Local Policies / User Rights Assignment / Manage auditing and security log
Local Policies / User Rights Assignment / Generate security audits

and you must be an administrator to register security event source.

Based on article and source code from MSDN Magazine written by Mark Novak from Microsoft

Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 1,093 3/23/2018

Summary of changes made in this release of the package.