Introduction Elk It is a solution, is the abbreviation of Logstash, Elastaicsearch, Kibana, why use: Think you are a lot of system, out of the problem also to log on to the server to view the log, or the system deployed on the customer's machine, you do not even have permission to log on to someone else's server As a developer and fix bug!! Furthermore, our logs can be analyzed according to the log level, Kibana provides a lot of graphical display, a good analysis of the log, so as to detect system health.
- Data source: Can be from Redis, Nginx, Docker, RABBITMQ, Consul, System log and so on a variety of log files.
- Logstash: Open source Server data processing pipeline that can collect data from multiple sources at the same time, transform data, and then store the data in a database.
- Elastaicsearch: Search, analyze, and store data.
- Kibana: Data visualization web.
- Beats: A platform for light-weight collectors. From Edge machines want Logstash and elasticsearch to send data.
Filebeat: Lightweight log collector.
Installing ElkThis is a lazy installation, Docker container installation, before installation to ensure that they have installed Docker-compose, installation address: Https://github.com/deviantony/docker-elk.git, After installation Access service address: http://localhost:5601,http://localhost:9200.
Elk official Chinese documents
Elasticsearch authoritative Guide Chinese version (2.x)
Kibana Chinese Manual (6.0)
All right, elk content here! Suggest, best look at a document, do not go to see the blog, because are copied to copy, want to curse. Split Line
--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------
ABP Integrated Elk
- ABP began to be Log4, and at first thought LOG4 could support integrated elk here, followed by a comparison pit. Since there is no NuGet package supported by LOG4, follow-up goes to Nlog. ABP Many documents say conversion log management is very simple , a lot of blog is a pen, know it is not know why, I see these blog heart already is steeds, MMP, Finally find an open source ABP NLog package Abp.Castle.NLog on GitHub, plus two additional package nlog.web.aspnetcore,nlog.extensions.logging, if you don't install it, Some of the parameters in Nlog.config you will not be available.
. NET Core Configuration Nlog
Nlog configuration file:
<?xml version= "1.0" encoding= "Utf-8"? ><nlog xmlns= "Http://www.nlog-project.org/schemas/NLog.xsd" xmlns: Xsi= "Http://www.w3.org/2001/XMLSchema-instance" autoreload= "true" internalloglevel= "Warn" internallogfile= " Internal-nlog.txt "> <extensions> <add assembly=" NLog.Web.AspNetCore "/> </extensions > <vari Able name= "Logdirectory" value= "${basedir}\logs\"/> <!--define various log targets--> <targets> <!- -write logs to file--> <target xsi:type= "file" Name= "Allfile" Filename= "${logdirectory}\nlog-all-${shortdate}. Log "layout=" ${longdate}|${logger}|${uppercase:${level}}|${message} ${exception} "/> <target xsi:type= "Network" name= "elastic" keepconnection= "false" address = "TCP://IP addresses: +" ind ex= "Msglog-${shortdate}" layout= "${longdate}|${logger}|${uppercase:${level}}|${message} ${exception}"/> /> <target xsi:type= "NUll "name=" blackhole "/> </targets> <rules> <!--all logs, including from Microsoft--> <log Ger name= "*" minlevel= "Trace" writeto= "Allfile"/> <!--Skip Microsoft logs and so log only own logs--> < Logger name= "microsoft.*" minlevel= "Trace" writeto= "Blackhole" final= "true"/> <logger name= "*" minlevel= "Trace" writeto= "Elastic"/> </rules></nlog>
Note : The IP address where the port is configured for you logstash the input address:
ABP Log Write
ABP logs are injected directly into the code through attribute injection.
Say elk use installation, combined with. NET Core, ABP framework Nlog logs