istio gateway 日志解析正则


原始日志样例:

[2021-11-19T02:20:20.933Z] "POST /hu-api/mqttPush/checkLoginAuth HTTP/1.1" 200 - via_upstream "-" 0 80 2 2 "116.236.86.210" "okhttp/3.0.0" "6875420f-****-4c6a-ac36-dc5e22f1****" "**-gateway-center-uat.**.com" "10.26.*.184:8080" outbound|8080||**-gateway-center.****-uat.svc.cluster.local 10.26.*.95:41058 10.26.*.95:443 116.236.*.210:20905 *-gateway-center-uat.*.com - "-" "LSJA300000******" 

正则表达式:

"\[(?P[^\]]+)\]\s\\\"(?P[^ ]+)\s(?P[^\ ]+)\s(?P[^\ ]+)\\\"\s(?P[^\ ]+)\s(?P[^\\]+)\s+\\\"(?[^\\]+)\\\"\s+(?P\S+)\s+(?P[^\ ]+)\s+(?P\S+)\s(?P\S+)\s+(?P\S+)\s+\\\"(?P[^\\]+)\\\"\s+\\\"(?P[^\\]+)\\\"\s+\\\"(?P[^\\]+)\\\"\s+\\\"(?P[^\\]+)\\\"\s+(?[^\|]+)\|(?[^\|]+)\|\|(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s(?P[^\\"]+)\\\"(?[^\\"]+)\\\"\s+\\\"(?[^\\\"]+)\\\"\"

匹配结果: