db

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  ByteUnit = 1
	KB          = 1000 * B
	MB          = 1000 * KB
)

Variables

This section is empty.

Functions

func CheckLevel

func CheckLevel(flag, level string) bool

CheckLevel check log level

func CreateDBManager

func CreateDBManager(conf conf.DBConf) error

CreateDBManager -

func GetLevelFlag

func GetLevelFlag(level string) int

GetLevelFlag get log level flag

func GetServiceAliasID

func GetServiceAliasID(ServiceID string) string

GetServiceAliasID python: new_word = str(ord(string[10])) + string + str(ord(string[3])) + 'log' + str(ord(string[2]) / 7) new_id = hashlib.sha224(new_word).hexdigest()[0:16]

func GetTimeUnix

func GetTimeUnix(timeStr string) int64

GetTimeUnix get specified time unix

func MvLogFile

func MvLogFile(newName string, filePaths []string) error

MvLogFile 更改文件名称,压缩

Types

type ByteUnit added in v1.1.0

type ByteUnit int64

type ClusterMessage

type ClusterMessage struct {
	Data []byte
	Mode ClusterMessageType
}

type ClusterMessageType

type ClusterMessageType string
const (
	//EventMessage 操作日志共享
	EventMessage ClusterMessageType = "event_log"
	//ServiceMonitorMessage 业务监控数据消息
	ServiceMonitorMessage ClusterMessageType = "monitor_message"
	//ServiceNewMonitorMessage 新业务监控数据消息
	ServiceNewMonitorMessage ClusterMessageType = "new_monitor_message"
	//MonitorMessage 节点监控数据
	MonitorMessage ClusterMessageType = "monitor"
)

type EventFilePlugin

type EventFilePlugin struct {
	HomePath string // /wtdata/logs
}

EventFilePlugin EventFilePlugin

func (*EventFilePlugin) Close

func (m *EventFilePlugin) Close() error

Close Close

func (*EventFilePlugin) GetMessages

func (m *EventFilePlugin) GetMessages(eventID, level string, length int) (interface{}, error)

GetMessages GetMessages

func (*EventFilePlugin) SaveMessage

func (m *EventFilePlugin) SaveMessage(events []*EventLogMessage) error

SaveMessage save event log to file

type EventLogMessage

type EventLogMessage struct {
	EventID string `json:"event_id"`
	Step    string `json:"step"`
	Status  string `json:"status"`
	Message string `json:"message"`
	Level   string `json:"level"`
	Time    string `json:"time"`
	Content []byte `json:"-"`
	//monitor消息使用
	MonitorData  []byte `json:"monitorData,omitempty"`
	TimeUnixNano int64  `json:"timeUnixNano,omitempty"`
}

EventLogMessage 事件日志实体

type Manager

type Manager interface {
	// SaveMessage 保存消息
	SaveMessage([]*EventLogMessage) error
	// Close 关闭
	Close() error
	// GetMessages 获取消息
	GetMessages(id, level string, length int) (interface{}, error)
}

func NewManager

func NewManager(plugin, storePath string) (Manager, error)

NewManager 创建存储管理器

type MessageData

type MessageData struct {
	Message  string `json:"message"`
	Time     string `json:"time"`
	Unixtime int64  `json:"utime"`
}

MessageData message data 获取指定操作的操作日志

type MessageDataList

type MessageDataList []MessageData

MessageDataList MessageDataList

func (MessageDataList) Len

func (a MessageDataList) Len() int

func (MessageDataList) Less

func (a MessageDataList) Less(i, j int) bool

func (MessageDataList) Swap

func (a MessageDataList) Swap(i, j int)

type MonitorData

type MonitorData struct {
	InstanceID   string
	ServiceSize  int
	LogSizePeerM int64
}

Jump to

Keyboard shortcuts

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