Now you're ready to start typing your own variants on the cool searches you've been seeing Splunk paste into your search box. Try these variants in any order. Just paste these examples into your search box to illustrate the power of Splunk search commands.
timecharttimechart returns statistics bucketed by time and is good for driving line charts. Try these examples.
Count of deny events graphed by time.
Sum of bytes for GET requests by 5 second bucket.
Average bytes by method by 10 second bucket.
stats provides summary calculations by any field. Try it with a pie chart.
Total bytes sent by destination.
Let's get the top denied source IPs. This will work best with a bar chart.
You can also get the rarest 100 source IPs (by using rare).
whereLet's go back to our top source IPs and filter for ones with more than 5 denies by using the where command.
fieldsLet's display only the src field now (using fields).
sortWe can sort the results using the sort) command.
Now we're going to put it all together by doing another search to find which of the actions with more than 2 500 http status codes also had 200 successes (i.e. intermittently failing actions on our application.)
index::sampledata 200 [search index::sampledata 500 | top action| where count > 2 | fields + action]Do a search for errors in db2 and diff the first two results. When you use the diff command wiht no arguments, the first two results are compared by default.
Compare the host field of the 3rd and 4th results.
Now, find the amount of time between two events by comparing the values of the date_time field.
Return all urls that have 404 errors but no 303 errors (using set).
The regex command is useful in removing results from your search results. Use a regular expression in regex to remove results that do not match the regular expression. Regex is useful in finding regular expressions in search results.
Note: if you want to use the "or" ("|") command in a regex argument, the whole regex expression must be surrounded by quotes (ie. regex "<expression>").
Try the example below:
Note: Splunk's regex command supports inclusion of PCREs (Perl Compatible Regular Expressions).
Comments
No comments have been submitted.