Hi All,
I have a requirement to get the address values from a large log file along with the user details.
line1,line2,city,stateCode,postalCode,countryCode
. The below code as advised in the earlier post is giving the user data
zgrep -B1 "Failed to calculate Tax" log.2018-05-23.gz | grep "CartService" | grep -Eo '.{4}-.{2}-[^]]*|.{2}:.{2}:.{8}' | paste - -|sort -u -k3,3
Results.
2018-05-23 11:01:31,252 XX:XX:CC061367
2018-05-23 23:17:44,611 XX:XX:EW976815
The log file is as below.
[2018-05-23 11:01:31,251] app14.xx.xx.net 1527087690803 XX:XX:CC061367 http-nio-8080-exec-6 ERROR Get Price Failed! CC061367 , XX , XX (AbstractLocalP
ricingServiceV1)
[2018-05-23 11:01:31,252] app14.xx.xx.net 1527087690803 XX:XX:CC061367 http-nio-8080-exec-6 ERROR Exception while search for products (CartService)
com.xx.xx.xx.xx.xx.xx: Error: Failed to calculate Tax. Error Number: '2' Error Description: 'A valid city/state or zip code required.' | Params: Address={
"line1" : "Haci # 34",
"line2" : " Vallescondido",
"city" : " Zaragoza",
"stateCode" : "MEX",
"postalCode" : "52937",
"countryCode" : "US"
} taxType=Sales
Please advise how to get the address values along with the user details with heading like below.
Expected Results
Date Program line1 line2 city stateCode postalCode countryCode
2018-05-23 11:01:31,252 XX:XX:CC061367 Haci # 34, Vallescondido, Zaragoza, MEX, 52937, US
2018-05-23 11:01:31,252 XX:XX:UWA38046 3-5-10 Haruhino, Asao, Kawa, KN, 215,US
Attempted couple of commands ,one sample as below but was not giving any results.
zgrep -B1 "Failed to calculate US Tax" log.2018-05-23.gz | grep "CartService" | grep -Eo '.{4}-.{2}-[^]]*|.{2}:.{2}:.{8}' | paste - -|sort -u -k3,3|zgrep -A2 "Failed to calculate Tax" log.2018-05-23.gz|egrep "line(1|2)"|egrep "city" |sort -u