In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
How to carry out unified log management in Tye, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Let's look at how to manage logs uniformly in Tye.
Essential log management
Logging and analysis of applications is an important means to diagnose and troubleshoot online problems. On the other hand, the direct record based on the console or file is not conducive to developers' direct reading or large-scale analysis.
Therefore, developers often choose some log management solutions such as Exceptionless or ELK to implement log management in online environment.
However, we still lack a log management solution that is small and available in the development environment, easy to deploy, minimum resource consumption and good visualization.
So, in this case, let's use the Seq tools that have been extended in Tye as log management and visualization tools for the development environment.
Create a test application
Create-tye-seq-test.sh
Dotnet new sln-n TyeTestdotnet new webapi-n TyeTestdotnet sln. / TyeTest.sln add. / TyeTest/TyeTest.csprojtye init
With the above command, we created a test API project and created the tye.yml file.
Start the application directly with the tye run command, and we can actually look up and see the log output in the console in tye dashboard:
The defect is also very obvious, and this way is very disadvantageous to reading and analysis.
Enable Seq logging and viewing logs
Open tye.yml and add the extended configuration of seq:
Tye.yml
Name: tyetestextensions:-name: seq logPath:. / .logsservices:-name: tyetest project: TyeTest/TyeTest.csproj
As can be seen from the above configuration:
Only one extensions node has been added. A child node of seq is set and the location of log storage is configured.
After starting with tye run, you can see the started seq service in dashboard.
Open seq and you can see the query interface of seq:
This is the easiest way to use seq.
The search method of seq is very similar to the streaming query statement of SQL. Developers can learn how to query using UI through the following link:
Https://docs.datalust.co/docs/the-seq-query-language
I don't want to redeploy Seq every time
We all know that when Tye stops running, it tries to stop all containers deployed this time, and Seq also runs as a container, so the container is automatically removed each time Tye is stopped. It's actually a bit of a waste of time.
Therefore, here is a further introduction to how to deploy a Seq locally for reuse for a long time.
In fact, according to the code in Tye, if a service named seq already exists in the service, the service is automatically used and the creation step is skipped.
Therefore, all we have to do is deploy a seq service locally and then add it to the tye.yml.
Seq can be installed using the Windows installation package or by using docker. This example will use docker for installation:
Docker-compose.yml
Version: '3.3'services: seq: image: datalust/seq restart: always environment: ACCEPT_EULA: y ports:-5380 80-5341 image 5341 volumes: -. / .seqlogs: / data
Use docker-compose up-d mode to start seq for a long time. Then you can find seq dashboard in http://localhost:5380.
Then, we modify the tye.yml:
Tye.yml
Name: tyetestextensions:-name: seqservices:-name: tyetest project: TyeTest/TyeTest.csproj-name: seq external: true bindings:-name: http containerPort: 5341
Here, the main changes are:
It is no longer necessary to specify the log storage location in extensions, because at this time it is an external seq service, and it no longer makes sense to specify this parameter.
A service named seq has been added, where external: true specifies it as an external service. Therefore, no attempt is made to create this service at startup.
In this way, the result after starting with tye run is consistent with the previous effect. However, a new seq instance is not restarted each time. Instead, we use the seq instance that we deployed manually. Greatly accelerated start-up speed.
Notice that it is the same as the previous mongo. Seq is not actively created when using tye deploy. Instead, it tries to use the service discovery mechanism to find a service called seq. This is actually a bit similar to manually creating a Seq instance in the previous section.
Therefore, if you are deploying a tye.yml with seq in extensions. Make sure that there is a service named seq in the k8s cluster so that the logs can be output properly.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 301
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.