Splunk SDK for C# Examples

The Splunk® SDK for C# v2.x provides a number of examples that show how to interact with the Splunk SDK for C# PCL. The topics in this section contain descriptions and instructions for all the examples that are included in the SDK.

Examples are located in the \splunk-sdk-csharp-pcl\examples directory. When you build the SDK, the examples are built as well.

This version of the Splunk SDK for C# contains the following examples:

Example

Description

authenticate

Authenticates to the server and print the received token.

environment_variable_monitor

Creates an example modular input that monitors changes to a system environment variable and logs them to Splunk Enterprise.

github-commits

Modular input example that streams commit events in a given GitHub repository.

list_apps

Lists apps installed on the server.

mock-context

Mock context for unit testing.

mock-interface

Mock interface for unit testing.

mock-object

Mock object for unit testing.

normal-search

Starts a normal search and polls for completion to find out when the search has finished.

random-numbers

Creates an example modular input that generates random number for logging by Splunk Enterprise.

saved-searches

Checks whether a report (saved search in Splunk Enterprise 5) already exists; if not, creates and runs a new report.

search-export

Starts an export search and displays preview results.

search-realtime

Creates a new real-time search and displays preview results, waiting for the user to cancel the search.

search

Starts a normal search and polls for completion to find out when the search has finished.

submit

Creates a new index in Splunk Enterprise, and submits events to that index.

Windows8

An example Windows Store search app.


Note: While you experiment with the examples and unit tests, consider saving your Splunk Enterprise host, port, scheme, username, and password as key-value pairs in a text file. For more information, see Save your connection info.