Comments (3)
🤖
Hello @keington! 👋
Nice to meet you! I'm Dosu, a bot here to assist you with bugs, answer your questions, and help guide you through the process of becoming a contributor. While we're waiting for a human maintainer to get back to you, feel free to let me know if there's anything else you need help with. Let's make your experience with Kratos as smooth as possible together!
根据我对Kratos v2.7.1的理解,Kratos框架确实具有内置的日志记录功能,并且提供了一个通用的日志接口,可以用于与外部日志服务(如Filebeat)进行集成。
这是Kratos的Logger
接口:
// Logger is a logger interface.
type Logger interface {
Log(level Level, keyvals ...interface{}) error
}
要与Filebeat或任何其他外部日志服务集成,您需要创建一个新类型,该类型实现此Logger
接口。然后,您的类型的Log
方法将处理将日志数据发送到外部服务的具体细节。
例如:
type FilebeatLogger struct {
// ... your fields here ...
}
func (f *FilebeatLogger) Log(level Level, keyvals ...interface{}) error {
// ... your code to send log data to Filebeat here ...
}
然后,您可以使用With
函数向记录器添加字段,并使用WithContext
函数更改其上下文。这些函数返回一个新的Logger
,您可以使用它进行带有添加的字段和上下文的日志记录。
然而,我在Kratos的存储库中没有找到任何关于Kratos v2.7.1是否已经与Filebeat进行了集成的信息。如果您需要更多关于如何实现这种集成的信息,我建议您查看Filebeat的文档以获取更多关于如何使用其API的信息。
希望这个答案对您有所帮助。如果您有任何其他问题或需要进一步的澄清,请随时提问。
Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
from kratos.
Hi, @keington,
I'm helping the Kratos team manage their backlog and am marking this issue as stale. The issue you opened requested support for writing logs to a remote Filebeat and then displaying or analyzing them in Elasticsearch. I have provided a detailed explanation and guidance on how to achieve this using Kratos v2.7.1's Logger interface. Additionally, there was a comment from shenqidebaozi questioning the need to proactively deliver the files to Filebeat.
Could you please confirm if this issue is still relevant to the latest version of the Kratos repository? If it is, please let the Kratos team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.
Thank you for your understanding and contribution to the Kratos project.
from kratos.
Just collect the files directly, why take the initiative to deliver them?
from kratos.
Related Issues (20)
- [Feature] log Helper sprint, sprintf is executed before Filter Level, the performance consumption is very high HOT 3
- [Question]Transaction nested conflict stuck HOT 3
- [Feature] consule register need suport tags[] HOT 2
- When the App stops, the ctx in the afterStop callback is not available HOT 3
- [Question] How to return other Status Code in a successful HTTP request? HOT 7
- [Feature] Add Unwrap to custom response writer. HOT 3
- [Proposal] config feature roadmap HOT 22
- [Feature] replace kratos metrics with otel metrics HOT 3
- [The modification of header file information of http response does not take effect] ctx.Header().Set("Content-Type", "application/octet-stream") HOT 5
- [Question] How to return a custom response json? HOT 1
- Package version dependency issue HOT 4
- go generate ./...failed HOT 5
- [Feature]Add svrType related fields in proto to protoc-gen-go-http and http transport HOT 3
- proto file used to build the api document reported an error HOT 1
- consul watch, the server is offline and will not receive any notification HOT 6
- [Feature] Add NewClient method to gRPC Client HOT 3
- [Question] DDD的最佳实践方式?包括CQRS、Clean Architecture、六边形结构 HOT 5
- [Question]请教下kratos如何定义支持上传文件接口? HOT 2
- metrics statistics and usage issues [Question] HOT 5
- `stream` response in proto failed to generate http client HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kratos.