Skip to content

Commit

Permalink
[ingester] alarm_event add user_id
Browse files Browse the repository at this point in the history
  • Loading branch information
lzf575 committed Sep 8, 2023
1 parent f7a92ef commit 362e6b2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions server/ingester/ckissu/ckissu.go
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,12 @@ var ColumnAdd635 = []*ColumnAdds{
ColumnNames: []string{"l7_parse_failed"},
ColumnType: ckdb.UInt32,
},
&ColumnAdds{
Dbs: []string{"event"},
Tables: []string{"alarm_event", "alarm_event_local"},
ColumnNames: []string{"user_id"},
ColumnType: ckdb.UInt32,
},
}

var ColumnDrops635 = []*ColumnDrops{
Expand Down
2 changes: 1 addition & 1 deletion server/ingester/common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
package common

const (
CK_VERSION = "v6.3.8.1" // 用于表示clickhouse的表版本号
CK_VERSION = "v6.3.8.2" // 用于表示clickhouse的表版本号
DEFAULT_PCAP_DATA_PATH = "/var/lib/pcap"
)
3 changes: 3 additions & 0 deletions server/ingester/event/dbwriter/alarm_event_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type AlarmEventStore struct {
Time uint32
Lcuuid string
User string
UserId uint32

PolicyId uint32
PolicyName string
Expand Down Expand Up @@ -76,6 +77,7 @@ func AlarmEventColumns() []*ckdb.Column {
ckdb.NewColumn("time", ckdb.DateTime),
ckdb.NewColumn("lccuid", ckdb.String),
ckdb.NewColumn("user", ckdb.LowCardinalityString),
ckdb.NewColumn("user_id", ckdb.UInt32),

ckdb.NewColumn("policy_id", ckdb.UInt32),
ckdb.NewColumn("policy_name", ckdb.LowCardinalityString),
Expand Down Expand Up @@ -108,6 +110,7 @@ func (e *AlarmEventStore) WriteBlock(block *ckdb.Block) {
block.Write(
e.Lcuuid,
e.User,
e.UserId,
e.PolicyId,
e.PolicyName,
e.PolicyLevel,
Expand Down
1 change: 1 addition & 0 deletions server/ingester/event/decoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ func (d *Decoder) writeAlarmEvent(event *alarm_event.AlarmEvent) {
s.Time = event.GetTimestamp()
s.Lcuuid = event.GetLcuuid()
s.User = event.GetUser()
s.UserId = event.GetUserId()

s.PolicyId = event.GetPolicyId()
s.PolicyName = event.GetPolicyName()
Expand Down

0 comments on commit 362e6b2

Please sign in to comment.