日志收集统计逻辑
2024-04-24 18:32:56 0 举报
AI智能生成
日志收集统计逻辑
作者其他创作
大纲/内容
main.go
主函数
部署路径
子主题 1
子主题 2
子主题 3
配置规则
App、Action、Source、EventEnum、ResourceID、ResourceName、Token、DeviceInfo、StartTime、EndTime、EventDescribe、APIVersion、Param1、Param2、Param3、Param4、Param5
event
EventEnum、Token、DeviceInfo、StartTime、EndTime、ErrorDescribe、APIVersion
error
输入格式
输出格式
api-log
日志接口
api-event-log
日志队列
分支主题
phenix-job
任务中心
nohup ./service-log-extraction -runmode=prod 2>&1 >> info.log 2>&1 /dev/null &
调度脚本
调度机制
select * from log_device_event where (startTime between config.LastUpdateTime and yesterday) and eventCode="DEVICE_LOGIN_EVENT"
数据来源
select * from log_device_login where deviceId=? and createDay=createDay limit 1
去重
insert log_device_login(ID、DeviceID、RoomID、EventCode、EventBody、StartTime、TenantID、TenantName、CreateDay)
更新
syncLoginEvent(开机设备数)
select * from log_device_play where deviceId=? and createDay=createDay limit 1
insert log_device_play (ID、DeviceID、RoomID、EventCode、EventBody、StartTime、TenantID、TenantName、CreateDay)
syncPlayEvent(点播设备数)
insert log_device_orders(id、deviceId、roomId、orderNo、startTime、TenanID、TenantName、ResourceId,ResourceName、PayStatus、CreateDay、SumPrice)
syncOrderEvent(订单)
syncActiveDeviceEvent(活跃设备数)
job.SyncEvent
5:00
调度时间
select * from sys_job_config where jobId="LOGIN_JOB" and lastUpdateStatus=1
获取昨天更新的时间
计算时间的distance
执行SyncEvent
sys_job_config更新lastUpdateTime=config.LastUpdateTime
i := int64(0); i <= distance; i++
if distance!= 0
syncEventBaseJob
select * from sys_job_config where jobId=SUMMARY_JOB and lastUpdateStatus=createDay
获取config
SELECT count(id) FROM log_device_login where createDay=createDay and tenantId=?
LoginNum
PlayNum
select count(distinct deviceId) from log_device_play where createDay=? and tenantId=?
PlayDeviceNum
RoomNum
DeviceNum
select * from log_device_orders where createDay=? and tenantId=?
来源
insert log_device_summary_day
5:00
select * from sys_job_config where jobId=SUMMARY_JOB and lastUpdateStatus=1
获取昨天更新时间
执行syncEventSummaryJob
i := int64(0); i <= distance; i++13;if time.now()=lastUpdateTime continue
调度策略
syncEventSummaryJob
Init
运营数据汇总
8:00
运营二次汇总
清洗维度
service-log-extraction
日志清洗
Title:day
Remark:"15:04:05"
UndoneOrderSum
DoneOrderSum
undoneOrderSum + doneOrderSum
OrderSum
OrderPrice
PackageOrderSum
OrderSummary
TenantName
WxOrderSum
AliOrderSum
OrderPriceStr
TenantOrder(按天统计)
TenantOrderList
return OrderSummaryBI
GetOrderSummaryBI
./task-order-mail -runmode=prod -method=sendOrderSummaray -dayType=today
调度命令
朝九晚六工作时间内每50分钟
每一个小时
./task-order-mail -runmode=prod -method=sendOrderSummaray -dayType=today -toUser=wangyupeng@unitedview.cn
订单发送-指定发送人\t
9点
./task-order-mail -runmode=prod -method=sendOrderSummaray -dayType=yesterday
订单邮件-次日达
sendOrderSummaray
订单告警
Title
Remark
Unpaid
非Unpaid
return OrderCheckBO
GetTenantOrderListByTime
./task-order-mail -runmode=prod -method=SendOrderWarning
SendOrderWarning
统计维度
task-order-mail
服务告警
日志收集逻辑
0 条评论
下一页