-
Notifications
You must be signed in to change notification settings - Fork 54
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
How to change the encoder #260
Comments
It seems to me that encoder is more for usage when writing the logs that would expect a format like json. This library is internal to tomcats current usage and would not make use of the logging. I'm not sure what value that would bring here. Although I'm open to more discussion on this. A possible PR and/or overview of how this would be beneficial, would be a big help. Adding link here to logstash encoder |
Thanks for the quick answer... I couldn't solved this yesterday but I have it running now, nothing like giving some extra time to the ideas. A little of context... we are migrating our platform to MSA and all new components are made with Spring Boot. But we still have our monolith that is deployed on tomcat 8.5.47. My first reaction, and that is way I run into your project, was to convert our monolith logging (even tomcat logging) to logback and have the same logging that SB is using. The whole solution is deployed over K8s. And now we are pushing it a little further, consolidating all the pod's logs on ELK. In order to do that we prefer to have a pre-parsed log in JSON format instead of the plain ones created by Pattern Layout. It is easy that way to send it to logstash directly, avoiding all the RegEx parsing... Do you know a different approach for this? |
That makes perfect sense. Since the logstash encoder is currently written to support using logback directly, I think it would require building out a separate copy of the logstash module that uses the tomcat-slf4j-logback library (just import differences). That could be accomplished in similar way using maven to do the work without additional coding. Part of what is going on with this library and tomcat in general is to avoid conflicts if different libraries are later used for logging. So the extras like jackson probably wouldn't hurt anything by simply being in the tomcat/lib. I'm not sure how much work that would be but I do think it's possible to build such support. |
I couldn't make it with the libraries on the lib folder... but it works perfectly fine following the same approach you use for logback jars... I just include the encoder and json libraries in the tomcat-juli ;) Thanks! |
sorry, how exactly have you made this work @nicorbes ? tomcat-juli in question has the following structure (unless i'm looking at the wrong file?)...never mind the versions there
so you just added logstash-logback-encoder and logback-jackson jars to the lib folder and package back? doesn't seem right..i'm missing something |
ooo...i figure it out. so the pom file in the parent project needs to be changed a bit to include the encoder and json libraries. any chance you can another module project for logstash @hazendaz ? |
If a PR is raised, certainly..
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: Alin Simionoiu <notifications@github.com>
Sent: Friday, December 13, 2019 9:39:15 PM
To: tomcat-slf4j-logback/tomcat-slf4j-logback <tomcat-slf4j-logback@noreply.github.com>
Cc: Jeremy Landis <jeremylandis@hotmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [tomcat-slf4j-logback/tomcat-slf4j-logback] How to change the encoder (#260)
ooo...i figure it out. so the pom file in the parent project needs to be changed a bit to include the encoder and json libraries.
any chance you can another module project for logstash @hazendaz<https://github.com/hazendaz> ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#260?email_source=notifications&email_token=AAHODI73S2DVQYOFE7QFRTTQYRBNHA5CNFSM4JP3RL4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG3X5EY#issuecomment-565673619>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAHODI6E6QM6TRBGFC7XTX3QYRBNHANCNFSM4JP3RL4A>.
|
@AlinS / @nicorbes I was able to add logback json encoder and related dependencies in tomcat-juli.jar (#20) and I can see tomcat console logs published in Elk stack(Kibana). But I want to send the application logs to elk. Application is bundled as war file and deployed in tomcat. |
There are really 3 spots for configuration.
If running tomcat with single application, the lib is where you want to place things to ensure all is using slf4j/logback. If underlying wars are using other loggers though you would need to strip those out to pull that off. |
closing old ticket as logstash is documented now and included in releases. |
Hi guys, I wonder how could I use the
net.logstash.logback.encoder.LogstashEncoder
encoder on your logback.xml configuration file...How to include the classes into the tomcat-juli.jar?
Thanks in advance!
The text was updated successfully, but these errors were encountered: