This is a creation in Article, where the information may have evolved or changed.
Part ten: Go microservices-Centralized logging
This article describes our go microservices log policy based on Logrus, Docker gelf log driver, and loggly services (Logging as a service).
- A structured, pluggable log function in Logrus:go language.
- Docker gelf Log drive: is a convenient format that can be understood by many tools, such as Graylog, Logstash, Fluentd, and so on.
- Loggly: This is a SaaS solution for log data management. Use it to bring logs from the depths of your entire infrastructure to a place where you can track your activities and analyze trends. Most importantly, loggly is a managed service that allows you to use loggly without any additional hardware or software, and can be dynamically scaled to the action.
Brief introduction
Log. You don't know how much you're going to lose until you do. It may be one of the key factors in creating maintainable applications for your team to develop what to record, when to record, and how to record. Then, the microservices happen.
Although some log files are usually manageable for a single application (although there are exceptions ...), it is also possible to use hundreds of or even thousands of service containers to generate logs for microservices-based applications. If you don't have a solution to collect and summarize logs, you can't basically think about getting bigger.
Thankfully, a lot of smart people have come to think of this-the famous stack called Elk is probably the most famous one in the open source community. It is a elastic Stack (ELK) consisting of Elasticsearch, Logstash and Kibana, and is recommended for use on both the resident and cloud hosts. However, Elk's articles are all over the place, so this article explores a centralized logging solution based on four parts Laas:
- The log framework for Logrus:go languages.
- Docker gelf Drive: Greylog log drive in Extended log format.
- Gelftail: The lightweight log aggregator to be built in this article.
- Loggly: a Laas provider. Provides similar ability to manage and function log data as a similar service.
Solution Overview
Source
Https://github.com/walkerqiao ...
1. logrus-go Language Log API
2. Docker Gelf Drive
3. Log aggregation with Gelftail and log collection
4. Loggly
Summarize
In this article we looked at the centralized log aspect-why it is important, how to format the Go microservices log, how to use the log drive inside the container orchestration to pre-preprocess the log before uploading the log status to the Laas provider.
In the next section, it's time to use Netflix Hystrix to add circuit breakers and resiliency (resilience) to our microservices.
Chinese and English control
- Log as services: Logging as a service (LaaS).
- Elk:electic Search, LogStash, Kibana three first letter combinations. Typically three mates are used to form the Elk protocol stack.
Reference links
The structured, pluggable logging feature in the
- Logrus:go language.
- Elastic Stack: Centralize, transform, and store your data. is an open-source, server-side data processing pipeline that collects data from multiple sources at the same time, transforms it, and sends it to your favorite stash (naturally elastic Search for us).
- Kibana:kibana lets you visualize your elastic search data and browse the elastic Stack so you can see why it was paged at two o'clock in the morning to understand the impact of the rainy season on your quarterly numbers. The core of the
- elasticsearch:elastic stack. A distributed, restful search and analysis engine capable of solving growing use cases. As the core of the elastic stack, it centralizes the storage of data, so you can spot expectations and discover unexpected situations.
- Docker gelf Log Drive: A convenient format that can be understood by many tools, such as Graylog, Logstash, Fluentd, and so on.
- Loggly: This is a SaaS solution for log data management. Use it to bring logs from the depths of your entire infrastructure to a place where you can track your activities and analyze trends. Most importantly, loggly is a managed service that allows you to use loggly without any additional hardware or software, and can be dynamically scaled to the action.
- 10th Part
- Series article Home
- next section