Hi,
I have events with the below format:
"phone":{"areaCode":"732","prefix":"986","lineNumber":"0245",
Is there a way we could extract all the above values to a single field called phone as 732-986-0245?
Can someone please help us in this?
Thanks
Sarath
Just create a calculated field for the sourcetype (under Settings->Fields) and use the eval expression phone.areaCode."-".phone.prefix."-".phone.lineNumber
Make sure you elevate to app or system visibility and the field will show up whenever you search for that sourcetype.
This, of course, assumes that you have valid JSON events and not just the fragment you have shown us...
Try this
... | rex "Code.{3}(?<ac>\d{3})".*\b(?<pre>\d{3})\b.*\b(?<no>\d{4})" | eval phone=ac."-".pre."-".no
Correcting my question !!
we actually have the value as below in our events and we need to extract from events
Hi,
I have a event with below format
"phone":{"areaCode":"732","prefix":"986","lineNumber":"0245",
Is there a way, we could extract all the above to a single field called phone as 732-986-0245?
Can someone please help us in this?
Thanks
Sarath
Do you have json formatted events and right now you get 3 fields phone.areaCode
, phone.prefix
and phone.lineNumber
OR you just get a field say phone and that field contains the whole string "phone":{"areaCode":"732","prefix":"986","lineNumber":"0245"
?