Bringing data into Splunk (Continued...)

What happened behind the hood?

When we added the new log file to be monitored via the graphical interface, it created and added a configuration item into inputs.conf configuration file.

You can find the configuration file here:
  • $SPLUNK_HOME/etc/apps/search/local/inputs.conf
  • You can also manually edit this file and add your custom stanza, once done to notify Splunk about the changes, the daemon needs to be restarted.
  • It will contain something like this:
[monitor:///var/log/messages]
disabled = false
host = splunk_server
index = idx_messages
sourcetype = linux_logs

Above block is known as stanza, lets decipher this :) 
  1. monitor: This is used to specify which logfile(s) you want to monitor i.e. you can mention a specific logfile as well as full directory lets say you want to monitor everything under /var/log directory, just mention "monitor:///var/log/" and Splunk will try to index everything which is there in that directory.
  2. disabled: Lets say you want to disable a monitor temporarily then you can mention true instead of false.
  3. host: A meaningful hostname, so that people can easily understand from where the events are coming in.
  4. index: Name of the index in which you want your data to be indexed.
  5. sourcetype: Type of data which is being indexed.
Note: When Splunk monitors the data, initially it index everything which it finds then it maintains a record of where it last read the data from so that if incase there is new data then it can index that as well.


Comments

Popular posts from this blog

#3 Splunk sub(Commands) [eval, round, trim, stats, ceil, exact, floor, tostring]

#6 Splunk sub(Commands) [fields, rename, replace, table, transaction]

#1 Splunk sub(Commands) [top, rare, fields, table, rename, sort]