folkertvanheusden / multitail

Tail on steroids
https://vanheusden.com/multitail/
MIT License
121 stars 13 forks source link

Add syntax for uwsgi logs #40

Closed karolyi closed 1 month ago

karolyi commented 1 month ago

Hey,

please accept this contribution for this great powertool. :) I'm using this on many servers (within screen) and since I also watch uwsgi logs, I built this syntax which indeed works and highlights slow requests.

FreeBSD and Linux still has the 6.x version, I'm gonna look into improving upon that too.

karolyi commented 1 month ago

Huh, this is turning out to be more than just that.

I'm currently trying to get this working both on my Manjaro Linux and FreeBSD box. These are preliminary changes, FreeBSD is still bailing out on compiling the regexes with this:

 --*- multitail 7.1.3 (C) 2003-2022 by folkert@vanheusden.com -*--

The following problem occured:
-----------------------------
Failed to compile regular expression ' \[.*\.(\w*?)\s?\]'.
Reason: MultiTail warning: regular expression failed, reason: trailing backslash (\)

There is an extra flag on FreeBSD for regex compilation:

     REG_POSIX     Compile only IEEE Std 1003.2 (“POSIX.2”) compliant
                   expressions.  This flag has no effect unless linking
                   against libregex.  This is an extension, compatible with
                   but not specified by IEEE Std 1003.2 (“POSIX.2”), and
                   should be used with caution in software intended to be
                   portable to other systems.

I'll try and see if this helps in compiling the regexes.

karolyi commented 1 month ago

FreeBSD will need the libgnuregex library (available via pkg).

It seems that neither the libc-provided, nor the libregexp-provided functionality doesn't offer the lazy operator (?) and that is where it bails out. Only the errors were cryptic about it.

I just did a quick test, libgnuregex accepts the provided string.

karolyi commented 1 month ago

Okay, I had to reorganize cmakelists a bit, and added libgnuregex as a dependency for FreeBSD, because of the formerly reported incompatibility.

I also took the courage to put dovecot log highligting back (who took it out?).

This should be good to go now. I'll notify the FreeBSD maintainer that if you release this, it should be easy to compile FreeBSD too.

Also tested on my Manjaro Linux, compiles and works fine.

folkertvanheusden commented 1 month ago

Thanks for your work! Applied. I wonder: in your patch, you check for FreeBSD: do these changes apply to other BSDs as well?

regards

karolyi commented 1 month ago

Awesome, thank you!

I don't know if it applies to other BSD's but it probably does. Question is, do they have libgnuregex installable.

I'd keep it as is for now, and if someone comes proving that it compiles with those too using this patch's basics, it should be easy to extend to those.

karolyi commented 1 month ago

Also, could you please make a 7.1.4 tag so I can notify the freebsd project to update this?

folkertvanheusden commented 1 month ago

Done!

On Sun, Aug 11, 2024 at 12:40 PM László Károlyi @.***> wrote:

Also, could you please make a 7.1.4 tag so I can notify the freebsd project to update this?

— Reply to this email directly, view it on GitHub https://github.com/folkertvanheusden/multitail/pull/40#issuecomment-2282713073, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUN5IW7M4KLAE4MKMYQIEK3ZQ45PVAVCNFSM6AAAAABMAQM3VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSG4YTGMBXGM . You are receiving this because you modified the open/close state.Message ID: @.***>

karolyi commented 1 month ago

Thanks, you forgot to update the version file, but we'll take it :)

folkertvanheusden commented 1 month ago

Oops! I've created a 7.1.4a now.

On Sun, Aug 11, 2024 at 1:15 PM László Károlyi @.***> wrote:

Thanks, you forgot to update the version file, but we'll take it :)

— Reply to this email directly, view it on GitHub https://github.com/folkertvanheusden/multitail/pull/40#issuecomment-2282722447, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUN5IW3PIFFKSSQBAUYPSJDZQ5BUTAVCNFSM6AAAAABMAQM3VOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSG4ZDENBUG4 . You are receiving this because you modified the open/close state.Message ID: @.***>

folkertvanheusden commented 1 month ago

Hi,

Could it be that the patch breaks the cygwin version?

Failed to compile regular expression ' \[.*\.(\w*?)\s?\]'.Reason: MultiTail warning: regular expression failed, reason: repetition-operator operand invalid

folkertvanheusden commented 1 month ago

No, this \w usage is older than that.

CWempe commented 1 month ago

According to this, it looks like *? is not supported. At least if we are using POSIX regex.

This is what ChatGPT has to say about the error. 😉

I will have a look and check if my color schemes would still work with * instead of *?. Or maybe I can solve this otherwise.

I hope I will find some time in the next days.

folkertvanheusden commented 1 month ago

@CWempe hi! I may have already solved it! In c0ae091b03a6f72b6ce9bd407fdf84ffbf355ab8

karolyi commented 1 month ago

This is the same problem why FreeBSD needed libgnuregex, it seems. The '?' operator is rarely supported.

@CWempe, wasn't it you who added the openhab highlighting? That was the first log highlight my original compilation didn't start, because of that character. Strange it didn't occur to you earlier.

karolyi commented 1 month ago

Hey @folkertvanheusden,

please don't forget to push a tag for 7.1.5, I'd like to update the FreeBSD ports makefile :)

Thanks!

CWempe commented 1 month ago

@CWempe, wasn't it you who added the openhab highlighting? That was the first log highlight my original compilation didn't start, because of that character. Strange it didn't occur to you earlier.

Yes, it was me. But I did just edit the config file and used mulitail on my Linux systems. I did not compile anything. So I could not get any compile errors.

karolyi commented 1 month ago

Understandable, linux has the gnu regex library (it originates from there), so you've had no issues with the non-greedy operator.

Anyone else using multitail on other systems will need it. Not an issue since it's available, but it's why we've had to pull in those dependencies.