carina-studio / ULogViewer

Cross-Platform Universal Log Viewer.
https://carina-studio.github.io/ULogViewer/
MIT License
380 stars 39 forks source link

Need help to parse custom log pattern #31

Closed GreenNeon closed 7 months ago

GreenNeon commented 7 months ago

I have a log file with a custom pattern like below.

[2024-02-19T16:55:18.296] [DEBUG] product details v2 
 |-> get products - Total Article Not In DB: 0
[2024-02-19T16:55:19.327] [WARN] customers - Error on customers, customers doesnt have 'something'! {
  anything_goes: [ '0000600186' ],
  stack: 'Error\n' +
    '    at getStack (D:\\Repository\\something\\service\\custSapOnDB\\fnsomething.js:6:11)\n' +
    '    at module.exports (D:\\Repository\\something\\service\\custSapOnDB\\fnsomething.js:16:17)\n' +
    '    at Object.module.exports [as shiptoV2] (D:\\Repository\\something\\graphql\\resolver\\catalog\\shipToV2.js:159:28)\n' +
    '    at runMicrotasks (<anonymous>)\n' +
    '    at processTicksAndRejections (internal/process/task_queues.js:94:5)\n' +
    '    at async Promise.all (index 0)\n' +
    '    at async graphqlMiddleware (D:\\Repository\\something\\node_modules\\express-graphql\\index.js:125:26)'
}

I can get the first line with

.*^(\[(?<Timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+)\])\s\[(?<Level>\w+)\]\s(?<Title>.*)

But how to get the next line??

hamster620 commented 7 months ago

Hi @GreenNeon, you just need to define 2nd log pattern and set it as skippable and repeatable: image image

Here is a sample log profile based-on the log you provided: GitHub#31.json

GreenNeon commented 7 months ago

Work great, I understand now. Thank you for your response 😁.