I am able to see that the following search returns the same result for fieldformat as well as eval time conversion operation. Is there any significant difference between these two in performance wise or in any others?
index=_internal | head 1 | eval abc="1468308151" | fieldformat mytime=strftime(abc,"%H:%M") | eval mytime1=strftime(abc,"%H:%M") | table abc mytime mytime1 index=_internal | head 1 | eval abc="1468308151" | fieldformat mytime=strftime(abc,"%c") | eval mytime1=strftime(abc,"%c") | table abc mytime mytime1
Here mytime and mytime1 fetch the same results. as "12:51"
With the fieldformat command you can
use eval expressions to change the
format of a field value when the
results render. You can change the
format without changing the underlying
value of the field.
Eval will change the underlying value of the field.
thanks javiergn..so coming to this scenario, formattting my epoch time here going to work same right? no better performance over one another?
If there was any performance difference it would be tiny in any case but I couldn't say without running thorough tests.
What you need to keep in mind is whether you want your field value to change or not. If you want to keep the value as it is but just display it differently (user-friendly for instance), then use fieldformat. Otherwise eval can do.
fieldformat is good for viewing purpose, when you want to do some calculations on the underlying field you need to use eval and work out.
fieldformat creates an alias for a field leaving the original field value completely unchanged, whereas using
eval updates (completely destroys) the original field value and replaces it with a new value. There should be no difference in performance in either case.