hi i'm new to splunk. need some help.
I have below script:
| spath input=message
| search env=prod clAppNam="i-app" demographics.firstName != null
| table usrId, pId, email{}.emailTypeCode,email{}.emailAddress
| outputcsv Upsert_party_Address_Report
This results in below report:
usrid pid emailTypeCode emailAddress
1 222 home aaa@def.com
work bbb@def.com
1 333 work ccc@def.com
correspond ddd@def.com
1 444 home eee@def.com
I need the results as shown below..
usrid pid emailTypeCode emailAddress
1 222 home aaa@def.com
1 222 work bbb@def.com
1 333 work ccc@def.com
1 333 correspond ddd@def.com
1 444 home eee@def.com
Any help is greatly appreciated..
Try like this
......
| spath input=message
| search env=prod clAppNam="i-app" demographics.firstName != null
| table usrId, pId, email{}.emailTypeCode,email{}.emailAddress
| eval temp=mvzip('email{}.emailTypeCode','email{}.emailAddress',"##")
| mvexpand temp | rex field=temp "(?<emailTypeCode>[^#]+)##(?<emailAddress>.+)" | fields - temp
| rename emailTypeCode as email{}.emailTypeCode, emailAddress as email{}.emailAddress
| outputcsv Upsert_party_Address_Report
Try like this
......
| spath input=message
| search env=prod clAppNam="i-app" demographics.firstName != null
| table usrId, pId, email{}.emailTypeCode,email{}.emailAddress
| eval temp=mvzip('email{}.emailTypeCode','email{}.emailAddress',"##")
| mvexpand temp | rex field=temp "(?<emailTypeCode>[^#]+)##(?<emailAddress>.+)" | fields - temp
| rename emailTypeCode as email{}.emailTypeCode, emailAddress as email{}.emailAddress
| outputcsv Upsert_party_Address_Report
this solution worked. Thank you so much for the help!!
You're looking for the filldown command.
| spath input=message
| search env=prod clAppNam="i-app" demographics.firstName != null
| table usrId, pId, email{}.emailTypeCode,email{}.emailAddress
| filldown usrId pId
| outputcsv Upsert_party_Address_Report
unfortunately the filldown did not work..