Install Splunk logging for .NET

Splunk logging for .NET is included in the following products:

Splunk logging for .NET standalone packages

Splunk logging for .NET are available as standalone library packages for you to add to your .NET projects. You can install Splunk logging for .NET standalone packages in several ways:


  1. In Visual Studio, open the project whose activity you want to log to Splunk Enterprise.

  2. On the Tools menu, point to Library Package Manager, and then click Manage NuGet Packages for Solution.

  3. In the Manage NuGet Packages window, click Online from the list on the left, and then enter splunk into the Search Online field in the upper-right corner. The Splunk logging for .NET library packages appear in the list.

  4. Click the Install button for the logging library you want to install.

  5. In the Select Projects window, select the checkboxes next to the projects in which you want to install the package, and then click OK.

The Package Manager adds the logging library you chose and its dependencies to your project. Because both main libraries require the common library, you'll see Splunk.Logging.Common in the list of references in the Solution Explorer, along with either Splunk.Logging.SLAB or Splunk.Logging.TraceListener, depending on which one you installed.

Download a ZIP file

You can also install Splunk logging for .NET manually. Just download and import the one you want.

  1. Download the library you want as a ZIP file, and then extract the contents of the file. If you want, you can verify the integrity of the downloaded ZIP file as well:

  2. In Visual Studio, open the project whose activity you want to log to Splunk Enterprise.

  3. In the Solution Explorer, right-click References, and then click Add Reference.

    Screen shot of the Visual Studio Solution Explorer

  4. In the lower-right corner of the Reference Manager window, click the Browse button.

  5. Navigate to each extracted Splunk logging for .NET directory, open it, and then select both Splunk.Logging.Common.dll and the .DLL file that corresponds to the library you want (Splunk.Logging.TraceListener.dll or Splunk.Logging.SLAB.dll).

    Note: You must include the common library in addition to either the trace listener or SLAB sink library.

  6. Verify that both "Splunk.Logging.Common.dll" and the other library you selected have both been added to the Browse section of the Reference Manager window, and that their checkboxes have both been selected, and then click OK.

Splunk.Logging.Common and either Splunk.Logging.TraceListener or Splunk.Logging.SLAB now appear in the list of references in the Solution Explorer.


If you are interested in contributing to Splunk logging for .NET, you can get them from GitHub and clone the resources to your computer.

To build from source after extracting or cloning the libraries, first, from the root level of the splunk-library-dotnetlogging directory, open the src directory.

For each of the directories within src:

  1. Open the directory, and then open the .SLN file inside in Visual Studio.
  2. On the Build menu, click Build Solution.

This will build the .DLL files for all three libraries. To install one of the logging libraries into your project, continue with step 2 in the previous section.

The Splunk extension for Visual Studio

The Splunk extension for Visual Studio includes Splunk logging for .NET.

In addition, the Splunk extension for Visual Studio adds two new project types (a "Splunk SDK for C#" type and a "Splunk Modular Input" type) to Visual Studio. When you set up each project, you are given the option of automatically including one of the two Splunk logging for .NET libraries (.NET trace listener or SLAB sink). Upon completing the setup wizard, you'll notice that code has been added to your project that configures logging to a Splunk Enterprise instance.

For more information about how to take advantage of logging templates in the Splunk extension for Visual Studio, see Splunk extension for Visual Studio.