-
-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for multiple opid-field
s
#1359
Comments
I also would welcome multiple opid fields for a slightly different use case: A pair of origin and target opid fields to parse logs (matter smarthome SDK logs) that chain messages as follows:
Here the When going forward with "o", the contents of the origin field should be used to find the next line where it matches the target field. Whereas "O" should take the contents of the target field and search back for a line where it matches the origin field. |
I think both cases can be served by writing a script and adding some key bindings. In the top-of-tree, I've added a
The arguments to the script are the direction (i.e. @plan44 Do you have a custom log format for the logs that you posted that extract the fields in the message? Do you need help writing one? Unfortunately, the performance for this script might not be very good with large amounts of logs. I'm currently in the process of trying to address these performance issues in the top-of-tree, but haven't finished yet. There are still some bugs to work out. Let me also give a little background... The "opid" field is a bit special since it is recorded in the internal index that is built up when lnav is first scanning a log file. So, scanning for a matching opid is pretty quick since we don't need to reload the log messages from the disk to check their value. Supporting multiple opid fields would mean expanding the size of the index and increasing the initial indexing time, which is not something I'd like to do. Ultimately, it's more advantageous for me to improve the SQL indexing performance since that is generally useful. |
Oh, great, I guess
Yes, at least I tried to (thanks to the guide how to do it on regex101) , but it only seems to work half way. The regex parses the messages correctly as it seems, as the fields show up when I press "p" on a log line. I also see the table schema for my format (called (a little later:) I seem to make a fundamental error 😵💫 . In no case I ever got a search table to work, no matter if I specify it manuall with I really tried to figure it out myself, but now (again some hours later:) Unstuck! I found what silently made my custom format fail: I had |
Now that my custom format works, I could try this and yes, problem solved! I had to modify the script because of the different origin/target fields, so I added a fourth argument which specifies the field to search for. In those matter exchanges, the current value needs to be taken from the Here's the find-chip-msg script, now bound to F3/F4 with:
Thanks for the help and the fantastic tool! Wish I had discovered it a long time ago 😉 |
You can run lnav with the
I've pushed a change that raises an error if a value is defined with a builtin name.
Nice work on modifying the script! |
@plan44 Would other people be interested in the log format you made? Should I add it to the set of defaults? |
Maybe, yes - users of the p44mbrd matter bridge daemon, which is a (still very niche at this time) FOSS project. The problem with matter SDK log messages is that they are usually formatted by a host application which has its own logger, so timestamp etc. are different depending on where it is used. p44mbrd is only one of many hosts. Right now, I am working to create a format that can analyze Apple Log Console messages and extract matter SDK log info in the same way as for p44mbrd. The multifile/timestamp-sorted display of lnav is extremely useful for observation of interactions between two matter nodes, when there are problems (which I definitely have at hand here, that's why I needed to investigate log analysis for real in the first place...)
I guess it needs some work before one or the other of these formats can become a usable default. I changed the regex a few dozen times today to fine tune and fix problems... Also, ideally, I guess there should be a common sub-format for the matter SDK part, which then could be used in different host log formats (p44mbrd, apple, homeassistant etc.). I read about this somewhere in the lnav docs, but doing that is definitely over my head at this point 😵💫 Here my current WIP versions for reference appleconsole_log.json, p44mbrd.json |
Is your feature request related to a problem? Please describe.
There are multiple cases, when logs may have at least 2 event-chain identifiers.
For example, swarm of microservices will have different
tid
s/pid
s, but usually there is somerequest_id
, which is the main chain identifier. Sometimes it's necessary to follow another identifier --thread_id
in my case, other cases might exist.Describe the solution you'd like
opid
fields for the format, f.e.:opid
field or UI element displaying it.Describe alternatives you've considered
opid-field
configurable from UI. This will allow manual binding commands to change current field.opid-field
.The text was updated successfully, but these errors were encountered: