Fundamentals 3 Flashcards
What command enables you to calculate stats on data that matches your search criteria?
stats command
What does the | fieldsummary command do?
Calculates summary stats for all/subset of fields and displays in table form:
| fieldsummary [maxvals=num] [field-list]
- maxval: max distinct vals to return for the values stat of each field
- field-list: fields to calc stats for
What does the is_exact boolean indicate in the |fieldsummary results?
is_exact represents whether the distinct_count is exact
What does the |appendpipe command do?
- Takes existing results and pushes them into sub pipeline
- Appends sub pipeline results as new lines to the outer search
How do you name the appendpipe subtotals field after appending?
Use |eval column_name= “subtotals name”
How do you create a grandtotal field when using the |appendpipe command?
Use another |appendpipe command to search for and total only the subtotals fields
How do you use count and list functions to remove duplicates for info in tabular form?
- Use |stats count as normal
- Use |stats list(columnBfield), list(columnCfield) … by columnAfield
- Column A is no longer duplicated
What does the |eventstats command do?
Generates summary stats of all existing fields in search results and saves as new fields
- Works on entire results
What does |streamstats do
Generates stats on fields and compiles to previous data
- Works on entire results but calculates stats for each result row at the time command encounters it
- index order matters
What are two arguments that can be used with |streamstats
- current= t or f :include or not include current event in summary calc
- window=# : calc over past # of events
What does the |eval command do
Manipulate and calculate expression and creates a new field or overwrites existing one
|eval fieldname1=expression1, fieldname2=expression2
What are the |eval command conversion functions
tostring
tonumber
printf
What are the options for and syntax of the tostring function
tostring(field, “option”)
Options being: commas(also rounding to 2 decimals), duration(hh:mm:ss), hex
What are the options for and syntax of the tonumber function
tonumber(numstr,base)
Where numstr can be a field name or a number and base is optional
What are the options for and syntax of the printf function
printf(“format”,arguments)
Where format is conversion specifiers(%d,%f%s…) and arguments are optional
What does the eval now() function return
Time a search was started
What does the eval time() function return
Time event was processed by the eval command
What does the eval strftime function do
Converts timestamp to string format using strftime(X,Y) to convert epoch time to a readable format. Where x is UNIX time in seconds to be converted to a string
EX: Y= “%B-%d-%Y” yields format example February-19-2018
What does the eval strptime function do
Converts time in string format and parses it into a timestamp using strptime(x,y) where x is a time in string format and y is a timestamp format defined by variables
What does the eval relative_time function return
Returns timestamp relative to a supplied time as if asking for data a day prior to a certain event
What do the lower() and upper() functions of the eval command return
Conversion of string to lower or upper case
What does the eval substr(X,Y,Z) command return
Returns substring of X, according to the starting index Y and the length of Z
What does the eval replace(X,Y,Z) command do
Where X,Y,Z are all strings and Y is a regex, return a string where Z replaces each occurrence of Y in X
Note: eval commands do not alter the indexed data or write new data to index
Do non-numeric values need to be in quotations when using the if() function?
yes
What does the eval cidrmatch(X,Y) function return
Returns t/f based on whether provided IP address Y matches subnet specified in X
What does the eval match(subject,regex) function return
Returns t/f depending on whether subject matches defined regex
What does the eval coalesce(X1,X2…) function do
Retrieves the first value from the first field defined in the current event - used to normalize field names from results sets where two or more field names represent the same data field
Ex: combining fields with different names, but representing same data field, into one normalized field
What does the eval isnull() function return
Returns t/f if field is null
What does the eval typeof() function return
Returns a string that represents the data type of the argument (number, string, boolean etc)
Are strings or numbers considered greater than when dealing with min() and max() functions?
Strings are greater
What do the eval ceiling() and floor() functions return
Rounded up or down to the nearest whole integer
What are the eval cryptographic functions used for?
Used to compute and return secure, encrypted hash values of a string: md5, sha1, sha256, sha512
What does the | makeresults command return
By itself, generates one result with only _time field
Must be first command in search
Can be used with one or more eval commands
What is the default case sensitivity for Lookups
Default is case insensitive but this can be changed in advanced options when creating a lookup
What kind of lookup should be used for large tables or ones that are updated often?
KV(Key Value) Store
Where do KV Stores and CSV files live?
KV Store collections are on the SH.
CSV files are replicated to indexer.
Which type of lookup provides REST API access, multiuser access locking, and per-record insert and updates?
KV Store
Why would you use a CSV lookup over KV store?
Small csv table performs well, need case insensitive lookups, or integrating with other apps
Where is a KV Store collection defined?
Admin defines in configuration stanza in the collections.conf
Can you add results to a KV Store collection from SPL
Yes, use the outputlookup command to write results from a search to the collection provided data is shared and field names do not have . or $
What are scripted(external) lookups?
Lookup facilitated through use of a script used to populate events with field values from an external source
What language must the scripted lookup be written in?
Python script or binary executable
What are the arguments passed to the script when creating a new external lookup?
Arguments are the field headers from the input/output CSV files
What are geospatial lookups used for?
To create chloropleth map visualizations by matching coordinates from events to geographic feature collections in a KMZ or KML file
What command is used to access a geospatial lookup?
|geom featurecollectionname
What does the DB Connect (DBX) app do?
Allows you to use lookups to reference fields in an external SQL db; import data, export machine data to external db, or use SQL to build dashboard mixing splunk and db data
How are database lookups completed?
Through the DBX app via Data Lab and New lookup options
What command is used to access DBX lookups?
|dbxlookup lookup=”lookup name”