Documentation: 2.2.6
Print Version Contents
This page last updated: 04/28/07 01:04pm

Basic Server Operations

Add Splunk to Your Shell Path

Setting a SPLUNK_HOME environment variable and adding $SPLUNK_HOME/bin to your shell's path will save a lot of typing in the future. The example below works for bash users who accepted the default installation location. Use the correct syntax and path for your own installation.

# export SPLUNK_HOME=/opt/splunk
# export PATH=$SPLUNK_HOME/bin:$PATH

Start the Server

From a Unix shell prompt on the sever host, run this command.

# splunk start

Additional flags can be passed when starting Splunk.
--answer-yes Answers yes to any y/n question
--no-prompt Quits when user would be prompted
--accept-license Will accept the license agreement on first time startup
--debug Turns on verbose logging

Check if Splunk is running

From a Unix shell prompt on the sever host, run this command.

# splunk status

You should see this output on stdout .

splunkd is running
splunkSearch is running

Or you can use ps to check for running Splunk processes:

# ps aux | grep splunk | grep -v grep

Solaris users, type -ef instead of aux:

# ps -ef | grep splunk | grep -v grep

You should see two of them, similar to the example entries below.

The splunkd process is the search and index engine.

root 5057 31.1 1.3 426212 21472 pts/11 Sl 14:05 0:02 /opt/splunk/bin/splunkd

The twistd.py process is the Web server itself. It's a lightweight, Python-powered Web server that communicates with your browser via http, and communicates with splunkd via a SOAP application program interface (API).

root 5092 4.1 0.8 19500 12736 pts/11 S 14:05 0:00 python /opt/splunk/lib/python2.4/site-packages/splunk/core/twistd.py -noy /opt/splunk/lib/python2.4/site-packages/splunk/search/Search.tac

Finally, check for output logs from the server.

# tail -f $SPLUNK_HOME/var/log/splunk/splunkd.log

You should see a steady stream of messages arriving every few seconds.

Stop the Server

To shut down the Splunk Server, run this command.

# splunk stop

If you get the return status [FAILED] instead of [OK], or if the script seems to hang, try again. If the command still fails, grep for splunk processes. Use kill or kill -9 to shut them down, but be aware this may corrupt your index if the splunkd process is in the middle of indexing data. It's best to give it a minute to see if it exits on its own.

Restart the Server

To restart the server after making configuration file changes, click Admin on the upper left of the Splunk Server interface. Go to the Server -> Control panel to find the Restart button.

Or, from the server host's shell prompt, run this command.

# splunk restart

Index Your Data

If you have never set up a Splunk Server, click on Admin at the upper left of the interface and then click the Guided Setup option for step-by-step instructions.

To set up additional inputs, click the Admin -> Data Inputs tab and use the separate configuration panels for Files & Directories, FIFOs, Network Ports and Database Tables.

For more detailed instructions, see the section on Data Inputs.

Delete Data from the Index

Delete everything

Run this command on the Splunk Server host to delete all indexed data, users, and saved/live splunks:

# splunk clean all

Run this command to delete event data:
# splunk clean eventdata

Delete a subset of events

Use the delete:: modifier either in the search box of the Splunk Server's web interface, or from the command line on the Splunk Server host:

delete::<search-terms>

The syntax for delete:: is tricky for now:

  • You can only use one delete:: modifier per command.
  • You can additionally add one deleterestrict:: operator to further filter the command.
  • You can only restrict deletion by source, by host and by time range.
  • Additional search terms must come first.

For example, this Splunk will delete every event with host::10.1.1.72 from source::/var/log/anaconda.log whose timestamp is within the past day.

daysago::1 delete::host::10.1.1.72 deleterestrict::source::/var/log/anaconda.log

If you type delete:: into the web interface, you'll see a typeahead list of all allowable completions for a delete:: command on your data. The same is true for deleterestrict::.

The best way to use delete:: is like this:

  • First, create a search that returns only the events you want to delete.
  • Then, add delete:: in front of one of its parameters to delete the same set of events. Move the delete:: term to the rightmost end.

NOTE: The delete:: modifier does not free disk space on the index. The data still resides in the index, it simply cannot be returned in a search. If you need to recover the disk space you will need to use the command # splunk clean eventdata

Change Network Ports

Click Admin in the upper left of the Splunk Server interface. This will open the Admin page to the Server -> Settings tab, where you can change the port settings. If you set either your HTTP or HTTPS port to 0 listening on that service will be disabled.

Uninstall the Release

Your installation may have a different pathname to your Splunk software and files, depending on how it was installed.

To erase all traces of the Splunk Server installation, first stop the server.

# splunk stop

Then run the uninstaller in your installation's top-level directory.

# $SPLUNK_HOME/uninstall

Alternately, you can use these Unix commands to remove all traces of Splunk from your host.

# splunk clean
# rm -rf $SPLUNK_HOME
# userdel splunk
# groupdel splunk

By default your index was under the /opt/splunk directory and was removed by the commands above. But if you had relocated your index ($SPLUNK_DB) outside of /opt/splunk , erase that directory, too.

# rm -rf /foo/bar/splunkdb/

Start    |    Next: Users, Authentication & Access Control

Comments

No comments have been submitted.

Log in to comment.