Sum by error_no from loki logs

How do I aggregate and get count of unique error from Loki logs.
For eg I need count of pin_err_bad_value= 10, pin_err_vvv = 14 etc

my loki logs looks something like below-

2023-03-06 10:38:34
4a98ddd4f690eaa9839e268483ca4461db232fb046a63d0046b02eab6cbcceee
flush_thread_1
kt999cc15w005
pod-754d556d56-wp4pt
ff019aa7-02b6-404b-a495-3eb4d0a57f49
{“log”:“E Mon Mar 6 10:38:34 2023 pod pod:1344396 pod_utils.c(155):6405 2:wsm-tomcat-64f47d9678-b59jh:WebService3715:1678095514:15674::::\n\n\tpod pod->FM input flist: opcode=Ppod_OP_ECE_POST_COMMIT, flags=0x0, errno=PIN_ERR_UNKNOWN_EXCEPTION:66\n\n# number of field entries allocated 20, used 1\n\n0 PIN_FLD_POID POID [0] 0.0.9.8 /publish 0 0\n”,“stream”:“stderr”,“time”:“2023-03-06T09:38:34.764133053Z”}

2023-03-06 10:38:34
4a98ddd4f690eaa9839e268483ca4461db232fb046a63d0046b02eab6cbcceee
flush_thread_1
kt999cc15w005
pod-754d556d56-wp4pt
ff019aa7-02b6-404b-a495-3eb4d0a57f49
{“log”:“E Mon Mar 6 10:37:01 2023 pod pod:1344150 fm_utils_publish.c:755 2:wsm-tomcat-64f47d9678-b59jh:WebServic3715:1678095420:22719::::\n\n\tPpod_OP_ECE_POST_COMMIT returned an error\n\n\t<location=PIN_ERRLOC_EM:18 class=UNKNOWN:0 errno=PIN_ERR_UNKNOWN_EXCEPTION:66>\n\n\t<field num=0:0,0 recid=0 reserved=0 reserved2=0 time(sec:usec)=1678095:421275>\n\n\t<facility=0 msg_id=0 version=0>\n\n341918165 32 /oms/virtual_time/shared/pin_virtual_time_file\n”,“stream”:“stderr”,“time”:“2023-03-06T09:37:01.276536541Z”}
2023-03-06 10:38:29
dc2f8ff9af063e946579be080dabf2b42ceb25269b8447bc97e51df6d9235d7a
flush_thread_5
kt999cc15w004
pod-754d556d56-z7lh4
f2203d34-8a30-4651-9243-fa97987600bb
{“log”:“E Mon Mar 6 10:38:29 2023 pod pod:1339177 pod_utils.c(155):6405 2:wsm-tomcat-64f47d9678-b59jh:WebService3715:1678095508:15633::::\n\n\tpod pod->FM input flist: opcode=Ppod_OP_ECE_POST_COMMIT, flags=0x0, errno=PIN_ERR_UNKNOWN_EXCEPTION:66\n\n# number of field entries allocated 20, used 1\n\n0 PIN_FLD_POID POID [0] 0.0.9.8 /publish 0 0\n”,“stream”:“stderr”,“time”:“2023-03-06T09:38:29.349802685Z”}