Hi Splunkers,
I have defined a filed as follows using eval condition
| eval body = "Sample Example :-" .
" ---- " . " HOST INFORMATION: " .
" ---- Source Network Address: " . src .
" ---- Source Network Hostname: " . srcdns_hostname .
" ---- " . " END "
which produces the result as follows
Now, I would like to change the above result into the below format how can I achieve that
Sample Example :-
HOST INFORMATION:
Source Network Address: 1.1.3.5
Source Network Hostname: ABCD.net
END
An alternative to embedding newlines into the eval, you can do it with mvappend, e.g.
| eval body = mvappend("Sample Example :-","HOST INFORMATION: ", "Source Network Address: ".src, "Source Network Hostname: ". srcdns_hostname, "END ")
Note that this results in a different field compared to @richgalloway solution - that form will give you a single value field with embedded newlines, whereas mvappend gives you a multi-value field with each line a separate value of the field.
An alternative to embedding newlines into the eval, you can do it with mvappend, e.g.
| eval body = mvappend("Sample Example :-","HOST INFORMATION: ", "Source Network Address: ".src, "Source Network Hostname: ". srcdns_hostname, "END ")
Note that this results in a different field compared to @richgalloway solution - that form will give you a single value field with embedded newlines, whereas mvappend gives you a multi-value field with each line a separate value of the field.
Insert newlines in your eval using CTRL-Enter.
| eval body = "Sample Example :-
HOST INFORMATION:
Source Network Address: " . src . "
Source Network Hostname: " . srcdns_hostname . "
END "