Use your own danger .
Does this assume that all fields return something , except for those that you marked with asterisks (is that what an asterisk means)? There are also obvious cases of failure, such as nested brackets of any type, but if the logger prints reasonably reasonable messages, then I think you'll be fine ...
Of course, even I personally would not want to support this, but there you have it. Perhaps you should consider writing a regular analyzer instead, if possible.
Change This is marked as CW, since it looks more like the question “I wonder how it will turn out” than anything else. For quick reference, this is what I ended up in rubular:
^[^[]+\s+(\w+)\[(\d+)\]:([^:]+):(\d+)\s+\[([^\]]+)\]\s+[^\s]+\s+(\w+)\/(\w+)\s+(\d+)\/(\d+)\/(\d+)\/(\d+)\/(\d*)\s+(\d+)\s+(\d+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s(\d+)\/(\d+)\/(\d+)\/(\d+)\/(\d+)\s+(\d+)\/(\d+)\s+\{([^}]*)\}\s\{([^}]*)\}\s+\"([^"]+)\"$
My first programming language was Perl, and even I agree to admit that I was scared of it.
eldarerathis
source share