I created a .CSV file with error_code and Description. I am trying to compare error_code with the logs and create a pie chat that shows all the error descriptions. I tried ...
Index=my_index | [|inputlookup error.csv | fields error_code | rename error_code as query]
... it seems to find the right logs but, it’s not a giving stats count by error_code.
Thanks!
@sandeepmakkena
Can you please try following search?
Index=my_index | rex field=_raw "errorCode\\\\\":\\\\\"(?<error_code>\d+)\\\\\"" | lookup error.csv error_code OUTPUT description | stats count by description
My Sample Search:
| makeresults
| eval _raw="000xxxx XXXXX log Call failed for endpoint XXXX after 703 milliseconds with message {\"requestingSystemId\":\"System1\",\"externalReferenceId\":\"xxx123xxx\",\"responseCode\":\"GROUP_FAILURE\",\"responseDescription\":\"Accounting instruction rejected as processing of one or more accounting entries was unsuccessful\",\"entries\":[{\"externalReferenceId\":\"System1/TransactionId/1/2\",\"responseCode\":\"ACCOUNT_LOCKED\",\"responseDescription\":\"40070,400,AccountOptedOutException: \",\"processingStatusCode\":\"REJECTED\",\"accountBalance\":{\"updateAmountDateTime\":\"Date.000+0000\",\"accountBalance\":0,\"availableBalance\":0,\"source\":\"CACHE\"},\"adapterDescription\":\"adapter1\",\"destinationAccountId\":\"xxxx....xxxx\",\"destinationAccountIdType\":\"yyyx\",\"supplementaryData\":\"{\\\"developerMessage\\\":\\\"AccountOptedOutException: \\\",\\\"errorCode\\\":\\\"40070\\\",\\\"gatewayErrors\\\":[{\\\"code\\\":\\\"40070\\\",\\\"gatewayName\\\":\\\"optout\\\",\\\"operation\\\":\\\"abc.gateway.optout\\\"}],\\\"httpStatus\\\":400,\\\"userMessage\\\":\\\"This account is opted out\\\",\\\"validationErrors\\\"::[]}\",\"errors\":[]}]} [accounting:50] [PaymentInterchange=123456789, PaymentInstruction=678912345, PaymentTransaction=14000xxx34, OPIC=null, RunId=null, uuid=null, origin=InterchangeLoaderMDBBean]" | rex field=_raw "errorCode\\\\\":\\\\\"(?<error_code>\d+)\\\\\"" | lookup error.csv error_code OUTPUT description | stats count by description
Updated Answer:
index=my_index | rex field=_raw max_match=0 "errorCode\\\\\":\\\\\"(?<error_code>\d+)\\\\\""
| rex field=_raw max_match=0 "responseCode\":\"(?<response_code>\w+)"
| eval error_code = if(isnotnull(error_code) AND error_code!="", error_code,response_code)
| table error_code | lookup error.csv error_code OUTPUT description | stats count by description
Thanks
index=my_index| fields error_code| join error_code[|inputlookup error.csv| fields error_code , Description]| stats count by Description
I tried that it’s not getting me any results. If this helps There is no error_code field extracted from the _raw events.
You dont have the error code parsed in your raw events? Can you extract the error code field using regex from raw events?
Thanks for the reply Vijeta, my ErrorCode looks like this \”errorCode\”:\”40025\”, I have hard time in getting regex working and also some of logs does not log errors codes but, just description. So the idea is list all those ErrorCode and error description into a lookup file, match with the log data and display on a dashboard with the count.
I am using this Rex “errorCode.*(?)” but it’ is not giving anything.