Splunk's file system change monitor lets you watch any directory you specify and generates an event when that directory undergoes any change. It is completely configurable and can detect when any file on the system is edited, deleted or added (not just Splunk-specific files). For example, you can specify that the file system change monitor watch /etc/sysconfig/ and alert you any time the entire system's configurations are changed.
How the file system change monitor worksThe file system change monitor detects changes using:
You can configure the following features of the file system change monitor:
By default, the file system change monitor will generate events whenever the contents of $SPLUNK_HOME/etc/ are changed, deleted, or added to. When you start Splunk for the first time, an add audit event will be generated for each file in the $SPLUNK_HOME/etc/ directory and all sub-directories. Any time after that, any change in configuration (regardless of origin) will generate an audit event for the affected file(s). The audit event will be indexed into the audit index (index=_audit).
You can use the file system change monitor to watch any directory by adding a stanza to inputs.conf.
Create your own inputs.conf in $SPLUNK_HOME/etc/system/local/. Edit this files in $SPLUNK_HOME/etc/system/local/, or your own custom application directory in $SPLUNK_HOME/etc/apps/. For more information on configuration files in general, see how configuration files work.
Edit the [fschange] stanza to configure the file system change monitor. Every setting is optional except the stanza name fschange:<directory or file to monitor>.
Note: Additions or changes to the [fschange] stanza require a restart of the Splunk Server.
[fschange:<directory or file to monitor>] index=<indexname> recurse=<true | false> followLinks=<true | false> pollPeriod=N hashMaxSize=N fullEvent=<true | false> sendEventMaxSize=N signedaudit=<true | false> filters=<filter1>,<filter2>,...<filterN>
[fschange:<directory or file to monitor>]
index=<indexname>
recurse=<true | false>
followLinks=<true | false>
Caution: If you are not careful with setting followLinks, file system loops may occur.
pollPeriod=N
hashMaxSize=N
fullEvent=<true | false>
sendEventMaxSize=N
signedaudit=<true | false>
filters=<filter1>,<filter2>,...<filterN>
Each of these filters will apply from left to right for each file or directory that is found during the monitors poll cycle.
To define a filter, add a [filter...] stanza as follows:
[filter:blacklist:backups] regex1 = .*bak regex2 = .*bk [filter:blacklist:code] regex1 = .*\.c regex1 = .*\.h [fschange:/etc] filters = backups,code
Comments
[monitor:<file or directory>] and [fschange:<file or directory>] should not be used to look for changes in the same directory structure- if both configuration stanzas are added to the inputs.conf file on your splunk instance, Splunk will be unable to do either function. Make sure you do one or the other. Also, don't forget to add an audit.conf if you are using "signedaudit=true'
Posted by fewdisc on Aug 01 2008, 10:30am