Admin Manual

 


Monitor WMI data

This documentation does not apply to the most recent version of Splunk. Click here for the latest version.

Monitor WMI data

Splunk supports WMI (Windows Management Instrumentation) data input for agentless access to Windows performance data and event logs. This means you can pull event logs from all the Windows servers and desktops in your environment without having to install anything on those machines.

The Splunk WMI data input can connect to multiple WMI providers and pull data from them. The WMI data input runs as a separate process (splunk-wmi.exe) on the Splunk server. It is configured as a scripted input in %SPLUNK_HOME%\etc\system\default\inputs.conf. Do not make changes to this file.

Note: This feature is only available on the Windows versions of Splunk.

Security and remote access considerations

Splunk requires privileged access to index many Windows data sources, including Event Logs, the Registry, and anything gathered remotely using WMI. This includes both the ability to connect to the computer you wish to poll, as well as permissions to read the appropriate data once connected.

To access WMI providers, Splunk must run as a user with permissions to perform remote WMI connections. This user must be a member of an Active Directory domain, and must have appropriate privileges to query WMI. Both the Splunk server making the query and the target servers being queried must be part of this Active Directory domain.

You'll need to have a domain account that is a member of the Domain Admins group to configure Splunk for this kind of access. If your account isn't a member of the Domain Admins group, you'll need to speak with someone who has that access, and have them perform these steps for you, or alternatively, can make your account a member of the Domain Admins group.

Note: If you installed Splunk as the Local System user, remote authentication over WMI will not work. The Local System user has no credentials to servers other than the machine on which the account resides. It is not possible to grant privileges to a machine's Local System account for access to another machine.

You can give the Splunk user access to WMI by doing one of the following:

Important notice regarding group memberships and resource Access Control Lists (ACLs)

We strongly discourage either placing domain users into local groups on member servers, or assigning users directly to resource ACLs. Doing so is a security risk. To maintain security integrity, it's best to create a domain global group first, put the Splunk user in this group, and then assign permissions to the group, or place the group into the appropriate local group(s) on the member server.

Permissions Checklist

Following is a least-permissive checklist of requirements that must be satisfied before Splunk can access resources over WMI. For additional information and step-by-step instructions, read this Community Wiki topic on enabling access to WMI for non-administrator users.

While this option is more time consuming than the others, it maintains security integrity by allowing only the minimum permissions needed for Splunk to access WMI providers.

Note: If you want to deploy these user rights assignments domain-wide, you must use the Domain Security Policy (dompol.msc) MMC snap-in; they'll be inherited by any member servers on the network in the next AD replication cycle (though you will need to restart Splunk instances on those servers for the changes to take effect.) If you need to extend this access to domain controllers specifically, you'll need to assign the rights using the Domain Controller Security Policy (dcpol.msc) snap-in.

Note: At this time, there is no standard facility to deploy WMI security settings remotely to multiple machines at once using Group Policy. This MSDN blog, however, offers instructions on how to create a startup script that you can place inside a Group Policy Object (GPO), which will set the namespace security once the GPO is applied to the desired hosts. You can then deploy this GPO domain-wide, or to one or more Organizational Units (OUs).

Test access to WMI

Follow these steps to test the configuration of the Splunk server and the remote machine:

1. Log into the machine Splunk runs on as the user Splunk runs as.

Note: If attempting to log into a domain controller, you may need to change your domain controller security policy to assign the "Allow log on locally" policy for the designated account.

2. Open a command prompt window (click Start -> Run and type cmd).

3. Go to the bin sub-directory under your Splunk installation (for example, cd c:\Program Files\Splunk\bin).

4. Run the following command: splunk cmd splunk-wmi -wql "select * from win32_service" -namespace \\<server>\root\cimv2, replacing <server> with the name of the remote server.

5. If you see data streaming back and no error message, that means your were able to connect and query successfully. If there was an error, there would be a message with a reason on why it failed (look for the error="<msg>" string).

Configure WMI input

You can configure WMI input either in Splunk Web or by editing configuration files. More options are available when using configuration files.

Configure WMI with Splunk Web

1. Click Manager in the upper right-hand corner of Splunk Web.

2. Under System configurations, click Data Inputs.

3. Click WMI collections.

4. Click Add new to add an input.

5. Enter a unique name for this collection.

6. Enter a target host and click Query... to get a list of the available classes of properties to choose from.

Note: Only classes that are prefixed with Win32_PerfFormattedData_ are displayed in the list. If the class you wish to index does not start with the Win32_PerfFormattedData_ prefix, you must add it manually by editing wmi.conf.

7. Optionally, provide a comma-separated list of additional servers from which to pull data.

8. Specify an interval in seconds between polls.

9. Ensure the Enabled? radio button is set to Yes and click Save.

The input is added and enabled.

Disabling or deleting WMI inputs

To disable a WMI input, navigate to it and select the No radio button under Enabled?.

It's not possible to delete a WMI input from within Splunk Web. To delete a WMI input, use the information in the section below titled "Configure WMI with configuration files" to edit the wmi.conf file and remove the [WMI:<input_name>] stanza you'd like to delete.

Configure WMI with configuration files

Look at wmi.conf to see the default values for the WMI input. If you want to make changes to the default values, edit a copy of wmi.conf in %SPLUNK_HOME%\etc\system\local\. Only set values for the attributes you want to change for a given type of data input. Refer to About configuration files for more information about how Splunk uses configuration files.

[settings]
initial_backoff = 5
max_backoff = 20
max_retries_at_max_backoff = 2
checkpoint_sync_interval = 2

[WMI:AppAndSys]
server = foo, bar
interval = 10
event_log_file = Application, System, Directory Service
disabled = 0

[WMI:LocalSplunkWmiProcess]
interval = 5
wql = select * from Win32_PerfFormattedData_PerfProc_Process where Name = "splunk-wmi"
disabled = 0

# Listen from three event log channels, capturing log events that occur only
# while Splunk is running.  Gather data from three servers.
[WMI:TailApplicationLogs]
interval = 10
event_log_file = Application, Security, System
server = srv1, srv2, srv3
disabled = 0
current_only = 1

# Listen for process-creation events on a remote machine
[WMI:ProcessCreation]
interval = 1
server = remote-machine
wql = select * from __InstanceCreationEvent within 1 where TargetInstance isa 'Win32_Process'
disabled = 0
current_only = 1

# Receive events whenever someone plugs/unplugs a USB device to/from the computer
[WMI:USBChanges]
interval = 1
wql = select * from __InstanceOperationEvent within 1 where TargetInstance ISA 'Win32_PnPEntity' and TargetInstance.Description='USB Mass Storage Device'
disabled = 0
current_only = 1

The [settings] stanza specifies runtime parameters. The entire stanza and every parameter within it are optional. If the stanza is missing, Splunk assumes system defaults.

You can specify two types of data input: event log, and raw WQL (WMI query language) The event log input stanza contains the event_log_file parameter, and the WQL input stanza contains wql.

The common parameters for both types are:

WQL-specific parameters:

Event log-specific parameters:

You can also use the current_only parameter in raw WQL stanzas to collect WMI event notification data. Check the wmi.conf configuration file reference for examples.

Fields for WMI data

All events received from WMI have the source set to wmi.

The host is identified automatically from the data received.

Troubleshooting WMI logging

If you encounter problems receiving WMI events, or are not getting the results you expect, you can enable debugging in Splunk's logging engine in order to get additional data.

In order to enable debugging for WMI, you'll need to set two parameters.

1. Edit log.cfg in %SPLUNK_HOME\etc. Add the following parameter:

[splunkd]
 category.ExecProcessor=DEBUG 

2. Edit log-cmdline.cfg, also in %SPLUNK_HOME%\etc. Add the following parameter:

 category.WMI=DEBUG 

3. Restart Splunk:

C:\Program Files\Splunk\bin> splunk restart

4. Once Splunk has restarted, let it run for a few minutes until you see debug log information coming into Splunk.

Note: You can search Splunk's logfiles within Splunk by supplying index="_internal" as part of your search string. Review this topic on Splunk log files for additional information.

5. Once enough debug logging has been collected, send a diag to Splunk Support:

C:\Program Files\Splunk\bin> splunk diag

Note: Remember to revert back to the default settings below once you finish troubleshooting.

In log.cfg:

category.ExecProcessor=WARN

In log-cmdline.cfg:

category.WMI=ERROR

Note: Any changes made in log.cfg are overwritten when you upgrade Splunk. Create a log-local.cfg for your specific needs to avoid this problem.

For more additional information on troubleshooting WMI, see this Community Wiki topic.

This documentation applies to the following versions of Splunk: 4.1 , 4.1.1 , 4.1.2 , 4.1.3 , 4.1.4 , 4.1.5 , 4.1.6 , 4.1.7 , 4.1.8 View the Article History for its revisions.


You must be logged into splunk.com in order to post comments. Log in now.

Was this documentation topic helpful?

If you'd like to hear back from us, please provide your email address:

We'd love to hear what you think about this topic or the documentation as a whole. Feedback you enter here will be delivered to the documentation team.

Feedback submitted, thanks!