How to grouping time and based on value with multiple pattern?

Hi All,

need help...

I have some log below :

[2019-07-18T01:08:41+0700][AsyncHttpClient-3-9][ERROR][test.system.interfaces.paybill.service.impl.DefaultPayBillViewService] ### {"request_id":"e8395eb0-a8bd-11e9-b77b-d507ea5312aa","message":"when inquiry paybill 628524871 prevalidation cause : Invalid Transaction"}
[2019-07-18T01:09:39+0700][AsyncHttpClient-3-30][ERROR][test.system.interfaces.paybill.service.impl.DefaultPayBillViewService] ### {"request_id":"043f2310-a8be-11e9-b57b-f9c7344998d7","message":"when inquiry paybill 62821615 prevalidation cause : Invalid Transaction"}
[2019-07-18T01:14:31+0700][AsyncHttpClient-3-6][ERROR][test.system.interfaces.paybill.service.impl.DefaultPayBillViewService] ### {"request_id":"b90c3b70-a8be-11e9-b77b-d507ea5312aa","message":"when inquiry paybill 62822535 prevalidation cause : Invalid Transaction"}
[2019-07-18T01:08:41+0700][AsyncHttpClient-3-9][ERROR][test.system.interfaces.paybill.service.impl.DefaultPayBillViewService] ### {"request_id":"e8395eb0-a8bd-11e9-b77b-d507ea5312aa","message":"when inquiry paybill 62852487 prevalidation cause : Internal Error"}
[2019-07-18T01:09:39+0700][AsyncHttpClient-3-30][ERROR][test.system.interfaces.paybill.service.impl.DefaultPayBillViewService] ### {"request_id":"043f2310-a8be-11e9-b57b-f9c7344998d7","message":"when inquiry paybill 62821615 prevalidation cause : Error"}
[2019-07-18T01:14:31+0700][AsyncHttpClient-3-6][ERROR][test.system.interfaces.paybill.service.impl.DefaultPayBillViewService] ### {"request_id":"b90c3b70-a8be-11e9-b77b-d507ea5312aa","message":"when inquiry paybill 62822535 prevalidation cause : Insufficient balance"}

and want grouping by time ( minutes ) and value , and expected result like below :

2019-07-18T01:08  Invalid Transaction 3
2019-07-18T01:08  Error 2
2019-07-18T01:08  Insufficient balance 1

need help ...

Thanks
hadi

Try

awk -F: '{sub (/\[/, "", $1); sub (/"}/, "", $NF); CNT[$1 ":" $2 " " $NF]++} END {for (c in CNT) print c, CNT[c]}' file
2019-07-18T01:14  Insufficient balance 1
2019-07-18T01:09  Error 1
2019-07-18T01:14  Invalid Transaction 1
2019-07-18T01:09  Invalid Transaction 1
2019-07-18T01:08  Invalid Transaction 1
2019-07-18T01:08  Internal Error 1

Your expected result can't be produced as there are no two identical time/value pairs in your sampe file.

1 Like

Hi rudic

thanks for your reply...its works