Reporting

How to include the current date and time in the email when using the sendemail command in a search?

rkanumula
Path Finder

hi,

i have to attach the current time in sendemail
Below is my search:

index=_internal| head 5|table source,sourcetype | sendemail to=abc@abc.com server=localhost subject="Report No 1 has been executed at"+""+now()  message="This is an example message" sendresults=true inline=true format=raw sendpdf=false

and also i have tried

index=_internal| head 5|table source,sourcetype | sendemail to=abc@abc.com server=localhost subject="Report No 1 has been executed at"+""+$_time$  message="This is an example message" sendresults=true inline=true format=raw sendpdf=false

but i am not getting the date in the message.

Getting Output:
Report No 1 has been executed at

Expected Output:
My Subject : Report No 1 has been executed at 27/05/2015 10.12.10 AM

Please suggest how to edit my search.

Thanks in Advance

Tags (4)
0 Karma

stephanefotso
Motivator

Hello!
Why don't you use the Email Actions dialog box to send your email? it will be simple, by using $job.earliestTime$ inthe subject field.
Thanks

SGF

manirao
Explorer

@ stephan

[November 05, 2018] [03:12:04] , this does not give AM or PM
So, either it should give AM/PM or give the value in 24 H format

Thanks in Advance

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...