_time
is actually in epoch format, Splunk just converts the format automatically before showing it to you so that it's human readable. So, to add 4 seconds, just do eval _time=_time+4
.
Note that this is purely a search-time operation - if you want to do this at index-time the problem is much more complex because functions for performing arithmetic etc are not available.
This works, and gives milliseconds:
convert timeformat="%Y/%m/%d %H:%M:%S.%3N" ctime(_time) AS timestr
What did you try that didn't work?
already tried
shouldn't the expected outcome be 23:03:39.846 ?
and for strftime/strptime, %3N, %6N
are the variables for milli- and microseconds, respectively.
http://docs.splunk.com/Documentation/Splunk/5.0.5/SearchReference/Commontimeformatvariables
hi
input time: 23:03:43.936
after subtracting 4.09
expected output time: 23:03:39.022
but output time is 23:03:39
i gave %ms after %S but not working and when i export it to CSV time column is not proper it show ### in the column
Your time format output truncates to seconds. You'll need to add some placeholder in the format string for milli / microseconds.
Explain more clearly. What do you mean by not being able to see milliseconds? What are you expecting to see, and what are you not seeing?
got it ..but i am not able to see milliseconds
index=tm_idx host="server" index=tm_idx host="server" "finished executing normally" | rex field=_raw "(?i)Process\s(\"|\"})(?
this is my search
Yup. Epoch is just seconds, so add how many seconds you want.
if it is 200 seconds then resulted output time should also have minutes modified