Skip to content

Commit

Permalink
- add debug message to notify when a transaction is ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
monicasarbu committed Mar 17, 2014
1 parent 98297e1 commit 6a2f264
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
1 change: 0 additions & 1 deletion http.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,6 @@ func receivedHttpResponse(msg *HttpMessage) {
// save Raw message
trans.Response_raw = string(cutMessageBody(msg))

DEBUG("http", "Http transaction %s -> %s\n", trans.Src.Proc, trans.Dst.Proc)
err := Publisher.PublishHttpTransaction(trans)

if err != nil {
Expand Down
17 changes: 4 additions & 13 deletions publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ func (publisher *PublisherType) PublishHttpTransaction(t *HttpTransaction) error
api.Domain = publisher.mother_host
api.Port = publisher.mother_port

// add single go struct entity
index := fmt.Sprintf("packetbeat-%d.%02d.%02d", t.ts.Year(), t.ts.Month(), t.ts.Day())

status := t.Http["response"].(bson.M)["phrase"].(string)
Expand All @@ -91,6 +90,7 @@ func (publisher *PublisherType) PublishHttpTransaction(t *HttpTransaction) error

if dst_server != publisher.name {
// duplicated transaction -> ignore it
DEBUG("publish", "Ignore duplicated Http transaction on %s: %s -> %s", publisher.name, src_server, dst_server)
return nil
}

Expand All @@ -102,6 +102,7 @@ func (publisher *PublisherType) PublishHttpTransaction(t *HttpTransaction) error
}
}

// add Http transaction
_, err := core.Index(true, index, "http","", Event{
t.ts, "http", t.Src.Ip, t.Src.Port, t.Src.Proc, src_country, src_server,
t.Dst.Ip, t.Dst.Port, t.Dst.Proc, dst_server,
Expand All @@ -118,7 +119,6 @@ func (publisher *PublisherType) PublishMysqlTransaction(t *MysqlTransaction) err
api.Domain = publisher.mother_host
api.Port = publisher.mother_port

// add single go struct entity
index := fmt.Sprintf("packetbeat-%d.%02d.%02d", t.ts.Year(), t.ts.Month(), t.ts.Day())

status := t.Mysql["error_message"].(string)
Expand All @@ -129,11 +129,7 @@ func (publisher *PublisherType) PublishMysqlTransaction(t *MysqlTransaction) err
src_server := publisher.GetServerName(t.Src.Ip)
dst_server := publisher.GetServerName(t.Dst.Ip)

if dst_server != publisher.name {
// duplicated transaction -> ignore it
return nil
}

// add Mysql transaction
_, err := core.Index(true, index, "mysql", "", Event{
t.ts, "mysql", t.Src.Ip, t.Src.Port, t.Src.Proc, "", src_server,
t.Dst.Ip, t.Dst.Port, t.Dst.Proc, dst_server,
Expand All @@ -151,19 +147,14 @@ func (publisher *PublisherType) PublishRedisTransaction(t *RedisTransaction) err
api.Domain = publisher.mother_host
api.Port = publisher.mother_port

// add single go struct entity
index := fmt.Sprintf("packetbeat-%d.%02d.%02d", t.ts.Year(), t.ts.Month(), t.ts.Day())

status := "OK"

src_server := publisher.GetServerName(t.Src.Ip)
dst_server := publisher.GetServerName(t.Dst.Ip)

if dst_server != publisher.name {
// duplicated transaction -> ignore it
return nil
}

// add Redis transaction
_, err := core.Index(true, index, "redis","", Event{
t.ts, "redis", t.Src.Ip, t.Src.Port, t.Src.Proc, "", src_server,
t.Dst.Ip, t.Dst.Port, t.Dst.Proc, dst_server,
Expand Down

0 comments on commit 6a2f264

Please sign in to comment.