#5 Splunk sub(Commands) [sendemail, dedup, eval, concatenate, new_field]
SENDEMAIL: This command helps you to send an email straight away from the search head itself. you just need to pass couple of values to it. 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. the results, set the priority of the email, give a message i.e. the body(if required).
DEDUP: This command helps de-duplicate the results based upon specified fields, keeping the most recent match.
EVAL: This command helps to evaluate new or existing fields and their values. There are multiple different functions available for eval command.
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. 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.
- Example: | sendemail to="XYZ@gmail.com" subject="Test Search Results" sendpdf=true priority=highest message="Please find attached latest search result" sendresults=true
DEDUP: This command helps de-duplicate the results based upon specified fields, keeping the most recent match.
- Example: | dedup txn-id
EVAL: This command helps to evaluate new or existing fields and their values. There are multiple different functions available for eval command.
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. 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.
- Example: | eval http_response=if(RC!=200,"Error","OK")
- Example: | eval Output=request." have a response code of ".RC
- Output will be something like: viewReport have a response code of 200
Comments
Post a Comment