unilog

package
v0.0.0-...-ea0e1bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2022 License: MIT Imports: 25 Imported by: 0

README

#集群分布式统一日志中心

技术架构升级:

模式: 单机 --> 分布式 :管理N服务N节点 日志滚动: ajax轮询-->SSE服务推送 2022/01/05: 节点重定向跳转--> 反向代理(避免暴露服务Host 免VPN)

  • 新增分布式日志节点导航页面

Documentation

Overview

Package unilog .分布式日志注册中心. 全局对外可用两个接口: GoStart: 分布式日志注册中心 GetHostByCode: 根据服务(集群)名称和code码 获取对应ip.

节点ip对应code码生成规则: 优先默认取其节点ip最后一组数字,比如 comment集群 节点ip: 192.168.1.105 那么code码对应为105. 假如comment集群已经存在i节点ip 192.168.2.105(先注册code码为105),那么节点ip: 192.168.1.105则将重新计算,从1开始寻找ip码空位.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogInfoNameFunc = func(app string) (logInfo, logErr string) {
	return app + ".log", app + "-err.log"
}

DefaultLogInfoNameFunc 默认的日志文件名称规则.

Functions

func GetAllAppHostMap

func GetAllAppHostMap() map[string][]string

GetAllAppHostMap 获取所有app的所有ip, map[app]hosts

func GetAllAppHosts

func GetAllAppHosts() []appHosts

GetAllAppHosts 获取所有app的所有ip

func GetHostByCode

func GetHostByCode(appName string, code int64) string

func GetHosts

func GetHosts(appName string) []string

GetHosts 获取一个app的所有ip

func GoStart

func GoStart(r router.Router, rpcServerAddr string, path logging.BasePath, logFunc LogInfoNameFunc, appNames ...string)

GoStart start the unilog. logFunc 根据app获取info日志和err日志文件名,不应包含路径. 用来做日志导航。

Types

type LogApp

type LogApp struct {
	BasePath string
	App      string
	Host     string
	LogInfo  string
	LogErr   string
}

type LogInfoNameFunc

type LogInfoNameFunc func(app string) (logInfo, logErr string)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func (*Server) Register

func (s *Server) Register(req *unilogrpc.UnilogRegisterReq) (*int64, error)

Register 分布式注册rpc方法

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL