Monitor Active Directory

Active Directory (AD) is an integral part of any Windows network. The Active Directory database (known as the NT Directory Service (NTDS) database) is the central repository for user, computer, network, device and security objects in an AD domain or forest. When you make a change to Active Directory, such as adding or deleting a user, member server or domain controller, those changes are recordable. Splunk lets you alert and monitor those changes in real time.

You can configure AD monitoring to watch changes to your Active Directory forest, and collect user and machine metadata. You can use this feature combined with dynamic list lookups to decorate or modify events with any information available in AD.

Once you've configured Splunk to monitor your Active Directory, it will take a baseline snapshot of your AD data and the AD schema. It will use this snapshot to establish a starting point against which to monitor. This process might take a little time before it completes.

The AD monitoring input runs as a separate process called splunk-admon.exe. It runs once for every Active Directory monitoring input defined in Splunk.

Why monitor Active Directory?

If you are charged with maintaining the integrity, security and health of your Active Directory, then you are concerned with what is happening with it day to day. Splunk allows you to see what has changed in your AD, who or what made the changes, and when they were made.

You can transform this data into reports for corporate security compliance or forensics. You can also use the data retrieved for intrusion alerts for immediate response. Additionally, you can create health reports with the data indexed for future AD infrastructure planning activities, such as assignment of operations master roles, AD replicas, and global catalogs across domain controllers (DCs).

What's required to monitor Active Directory?

The following table lists the explicit permissions needed to monitor an Active Directory schema.

Considerations for monitoring Active Directory

To get the best results out of monitoring AD with Splunk, be aware of the following:

This feature is only available with Splunk on Windows. You won't be able to monitor AD changes from a *nix version of Splunk (though you can forward AD data gathered from a Windows version of Splunk to a *nix indexer).

The AD monitoring process can run under a full Splunk instance or within any kind of forwarder.

The machine that's monitoring changes to AD must belong to the domain or forest you want to monitor.

The user Splunk runs as must be part of the domain too. This is because the permissions that the user has determine what parts of AD Splunk can monitor.

Configure Active Directory monitoring

You can configure AD monitoring either in Splunk Web or by editing configuration files. More options, such as the ability to configure monitors for multiple DCs, are available when using configuration files.

Configure AD monitoring with Splunk Web

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

2. Under "Data", click Data Inputs.

3. Click Active Directory monitoring.

4. Click New to add an input.

5. Enter a unique name for the AD monitor input.

6. Type in the name of a Target domain controller for Splunk to bind to in order to monitor AD.

Note: You can leave the field blank to tell Splunk to discover the nearest domain controller automatically.

7. Type in the name of a Starting node to tell Splunk where in the AD to start monitoring data, or leave the field blank to tell Splunk to monitor AD objects from the highest available part of the directory tree.

8. You can also click on the Browse button to display a tree view of AD objects that it can see, and select the desired object that way.

9. If you click the Browse button, the Active Directory window appears. This window displays AD containers and objects, starting from the highest point of the AD tree that Splunk has access to. Select the AD container or object that you want to monitor, then click Select to close the window.

Note: Containers are represented by folders, and objects are represented by document icons. When a container or object is selected, its qualified name appears in the Qualified name at the bottom of the window.

10. Select Monitor subtree if you want Splunk to monitor the child nodes below the starting node you specified in Steps 7-9.

11. Choose the destination index for this input.

12. Click Save.

Splunk adds and enables the input.

Configure AD monitoring with configuration files

Active Directory monitoring configurations are controlled by inputs.conf and admon.conf. Be sure to edit copies of these configuration files in the %SPLUNK_HOME%\etc\system\local directory. If you edit them in the default directory, any changes you make will be overwritten when you upgrade Splunk. For more information about configuration file precedence, refer to "About configuration files" in this manual.

1. Make a copy of %SPLUNK_HOME%\etc\system\default\inputs.conf and put it in %SPLUNK_HOME%\etc\system\local\inputs.conf.

2. Edit the copy and enable the scripted input [script://%SPLUNK_HOME%\bin\scripts\splunk-admon.path] by setting the value of disabled to 0.

3. Make a copy of %SPLUNK_HOME%\etc\system\default\admon.conf and put it in %SPLUNK_HOME%\etc\system\local\admon.conf.

4. Use the "Settings in admon.conf" section below to make edits to admon.conf.

Note: By default, when AD monitoring inputs are enabled, Splunk will gather AD change data from the first domain controller that it can attach to. If that is acceptable, no further configuration is necessary.

admon.conf settings

admon.conf contains one stanza for each AD monitoring input. In each stanza, you specify:

targetDc: The unique name of the domain controller host you want Splunk to use for AD monitoring.

Specify a unique name for this attribute if:

You have a very large AD and you only want to monitor information in a particular Organizational Unit (OU), subdomain, etc.

You have a specific (read-only) domain controller that is offered for monitoring purposes in a high security environment.

You have multiple domains or forests in with transitive trusts established, and want to use this to target a different tree than the one where Splunk resides.

You want to configure multiple AD monitoring inputs to target multiple domain controllers. For example, to monitor AD replication across a distributed environment.

Note: If you want to target multiple DCs, add another [<uniquename>targetDc] stanza for a target in that tree.

startingNode: A fully qualified Lightweight Directory Access Protocol (LDAP) name (for example "LDAP://OU=Computers,DC=ad,DC=splunk,DC=com") that specifies where Splunk should begin its indexing. Splunk starts there and enumerates down to sub-containers, depending on the configuration of the monitorSubtree attribute. If startingNode is not specified or is blank, Splunk will start monitoring AD data from the highest root domain in the tree it can access.

Note: The value of startingNode must be within the scope of the DC you are targeting in order for Splunk to successfully get AD data.

monitorSubtree: How much of the target AD container to index. A value of 0 tells Splunk to index only the target container, and not traverse into subcontainers within that container. A value of 1 tells Splunk to enumerate all sub-containers and domains that it has access to. The default is 1.

index: The index to route AD monitoring data to. If not present, the 'default' index is used.

disabled: Whether or not the input is enabled. A value of 0 tells Splunk that the input is enabled, and a value of 1 tells Splunk that the input is disabled. The default is 0 (enabled).

Example AD monitoring configurations

The following are examples of how to use admon.conf to monitor desired portions of your AD network.

Delete event

Splunk generates this event type when an AD object has been marked for deletion. The event type is similar to admonEventType=Update, except that it contains the isDeleted=True key/value pair at the end of the event.

Sync event

When AD monitoring inputs are configured, Splunk tries to capture a baseline of AD metadata when it is started. Splunk generates event type admonEventType=Sync, which represents the instance of one AD object and all its field values. Splunk tries to capture all of the objects from the last recorded Update Sequence Number (USN).

Note: When you restart either Splunk or the splunk-admon.exe process, Splunk will log an extra 'sync' event. This is normal.

Schema event

When Splunk is started after configured for AD monitoring, it generates a schema type event: admonEventType=schema. This event shows the definitions of every object in the Active Directory structure. The available, required and optional fields are listed for each AD object. Failure to see all of these fields can indicate a problem with Active Directory.

Comments

Why would events not be picked up on a delete? I am testing and I'm seeing lots of events from my DC but when I delete a user I don't get events with the isDeleted in them.

Stuartg orion

October 9, 2012

When one Splunk UF is configured to get admon events from two DCs, admon events from second DC come to indexer in almost real time. But the admon events from first DC has hugh delay (more than 2 minutes and I see 10 minutes delay in some cases). Is this a bug? It seems a bug where Splunk code can handle only one DC correctly. So far, I did not find a pattern for the number of delayed minutes. The delay time is just ramdomized. Sometimes longer and sometimes shorter. But is always on minute level, not second level.