Splunk Visualizations
Formatting Commands
| fieldscommand allows to include or exclude fields from results- e.g.,
| fields <field names>| fields - <field names>- to exclude fields
- space between operate and fields applies to all arguments
- if no space (
-field) then it only applies to that field
- limiting fields extracted makes searches more efficient
- e.g.,
| tablespecifies fields to transform data into a tabular format- similar to fields command
- but displays as table
- can use fields command with table command to limit search and make it more efficient
- similar to fields command
| dedupis used to remove duplicate results that share common values| addtotalscomputes the sum of all numeric fields for each row and creates a total column- can add a column summary with
| addtotals col=true- adds a row to bottom with column totals
- can add a label with
label="Total Sales"and the field to show the label inlabelfield="product_name" - can change the name of the label of the row totals with
fieldname="Total By Product" - can disable row totals (only column totals) with
row=false
- can add a column summary with
| fieldformatis used to format the appearance of values without making a change to the underlying raw data
Visualizing Data
- Click the Visualization tab in the search results
- most visualizations requires results structured as tables with at least 2 columns
- called single series
- Transforming commands order search results into a data table that can be used for statistical purposes
- needed to transform search results into a visualization
| top- finds the most common values of given fields in a results set
- automatically returns count and percent columns
- limits results to top ten by default
- use
limitclause to extend or show all resultslimit=0 - Clauses
limit = intcountfield = string- title of count column
percentfield = string- title
showcount = True/Falseshowperc = True/Falseshowother = True/Falseotherstr = stringby- shows top results split by another field
| top product_name by Vendor limit=3
| rare- same options as top command, but shows the least common values of a fieldset
| stats- produces statistics from search results
- common functions
- count
- distinct count
- sum
- average
- min
- max
- list
- values
asclause to rename the column label to something more intelligiblebyclause to group by another field
| chart- has two clauses
over- tells splunk which fields to be the x axis
- e.g.,
| chart count over status
by- used to split data by additional field
- can only use one field value
usenulls=fremoves nulls- better to remove nulls before chart command
userother=fremoves others
- has two clauses
| timechart- performs stat aggregations against time
- time is always x axis
- e.g.,
| timechart count by product_name - use
spanto change the time span of the clusterspan=12hr
| trendline- computes moving averages of field values
- requires 3 arguments
- trendtype
- simple moving average (sma)
- exponential moving average (ema)
- weighted moving average (wma)
- time period to compute the trend
- integer between 2 and 10000
wma2computes trend over last 2 days
- field to calculate trend from
- trendtype
- e.g.,
| trendline wma2(sales) as trend
Generating Maps
| iplocationcommand is used to add location information from a 3rd party database to an event- location data:
- City
- Country
- Region
- Latitude
- Longitude
- location data:
| geostatsaggregates data for use on a map- uses same functions as
statscommand - e.g.,
| geostats latfield=VendorLatitude longfield=VendorLongitude count by product_name - only accepts one
byargument
- uses same functions as
- Can use
geostatscommand with ip location information generated byiplocationcommand- e.g.,
| location src_ip | geostats latfield=lat longfield=lon count - default lat/lon values from iplocation are
latandlon
- e.g.,
- Choropleth Map use shading to show relative metrics over a predefined locations of a map
- requires a compressed Keyhole Markup Language file (
.kmz)- defines region boundaries
- splunk ships with 2
kmzfiles:geo_us_states.kmzgeo_countries.kmz
| geomcommand prepares events for use in choropleth map- adds a field to events that includes geographical data structures that match polygons on a map
- e.g.,
| geom geo_countries featureIdField=VendorCountry
- requires a compressed Keyhole Markup Language file (
Single Value Visualizations
- 2 types:
- Single Value
- displays a single integer
- formatting allows:
- adding text
- add coloring based on ranges
- change formatting
- can use
timechartcommand to add a trend to the visualization| timechart sum(price)
- Trellis option enables splitting visualization by selected field or aggregation
- Gauges
- can set color ranges
- Single Value
Visual Formatting
- Statistical Tables
- Format button
- wrap results
- add data overlay
- heat map
- highlight high and low values
- summary
- add totals and percentages to columns
- Format button
- Chart Overlay
- useful with
trendline - Format > Chart Overlay
- useful with