

#SPLUNK COMMANDS CODE#
The output will be something like: viewReport have a response code of 200įIELDS: This command helps to keep or remove specified fields from the search results, below command will keep just three fields in your search result.Let's say you want to create a new filed and concatenate results of multiple fields and bring them to your newly created field, below command will create a new field called "Output" and will have the value of two fields "request" and "RC" in addition to that some normal static text. of the response code is equals to 200 it will mark it as OK otherwise for all other response code it will mark it as Error. Lets say you want to add a new field, for doing so you can use something like given below, it command will create a new field based on the IF condition i.e. There are multiple different functions available for eval command. Example: | sendemail subject="Test " sendpdf=true priority=highest message="Please find attached latest search result" sendresults=trueĭEDUP: This command helps de-duplicate the results based upon specified fields, keeping the most recent match.ĮVAL: This command helps to evaluate new or existing fields and their values.

the results, set the priority of the email, give a message i.e. For instance to whom you want to send the email, if you want to keep anyone in cc/bcc, change the subject line (by default its "Splunk Results"), sendpdf(true or false) i.e. you just need to pass a couple of values to it. SENDEMAIL: This command helps you to send an email straight away from the search head itself.
#SPLUNK COMMANDS SERIES#
TIMECHART: Helps you to create a time series chart with respect to event statistics. The output will be something like this $98,622.96.Above example is converting the value which is there in "avg_revenue" to a string which consists of '$' and 'commas'.Example: | eval "Average Revenue" = " $" + tostring(avg_revenue, " commas").let's say if the input value is a number, it re-formats and changes it to a string, on the other hand, lets say if the input value is boolean, it returns either "True" or "False".

TOSTRING: Helps to convert an input value to a string. Round the value down to the nearest whole integer.Īpart from this, there are other functions as well which are used by eval command, for instance, pi(), sqrt() etc.Example: | eval Average= floor(Average).Give the output with the maximum possible number of decimal values.Example: | eval Average= exact(Average).Round the value up to the next highest integer.
