#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).
  • 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")
Lets say you want to create a new filed and concatenate results of multiple field and bring them to your newly created field, below command will create a new filed called "Output" and will have the value of two fields "request" and "RC" in addition to that some normal static text.
  • Example: | eval Output=request." have a response code of ".RC
    • Output will be something like: viewReport have a response code of 200 

Comments

Popular posts from this blog

#3 Splunk sub(Commands) [eval, round, trim, stats, ceil, exact, floor, tostring]

#6 Splunk sub(Commands) [fields, rename, replace, table, transaction]

#2 Splunk sub(Commands) [eval, trim, chart, showperc, stats, avg]