Skip to content

Commit

Permalink
For redis generate "packetbeat" keys (without date)
Browse files Browse the repository at this point in the history
  • Loading branch information
monicasarbu committed Jul 9, 2014
1 parent 328a29f commit f023fbb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 2 additions & 4 deletions output_redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (out *RedisOutputType) Init(config tomlMothership) error {
}
INFO("[RedisOutput] Redis connection timeout %s", out.Timeout)
INFO("[RedisOutput] Redis reconnect interval %s", out.ReconnectInterval)
INFO("[RedisOutput] Using index pattern [%s-]YYYY.MM.DD", out.Index)
INFO("[RedisOutput] Using index pattern %s", out.Index)
INFO("[RedisOutput] Topology expires after %s", out.TopologyExpire)
INFO("[RedisOutput] Using db %d for storing events", out.Db)
INFO("[RedisOutput] Using db %d for storing topology", out.DbTopology)
Expand Down Expand Up @@ -212,15 +212,13 @@ func (out *RedisOutputType) UpdateLocalTopologyMap(client *redis.Client) {

func (out *RedisOutputType) PublishEvent(event *Event) error {

index := fmt.Sprintf("%s-%d.%02d.%02d", out.Index, event.Timestamp.Year(), event.Timestamp.Month(), event.Timestamp.Day())

json_event, err := json.Marshal(event)
if err != nil {
ERR("Fail to convert the event to JSON: %s", err)
return err
}

out.sendingQueue <- RedisQueueMsg{index: index, msg: string(json_event)}
out.sendingQueue <- RedisQueueMsg{index: out.Index, msg: string(json_event)}

DEBUG("output_redis", "Publish event")
return nil
Expand Down
7 changes: 4 additions & 3 deletions packetbeat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
# Uncomment this option if you want to store the topology in Elasticsearch. By default is false.
# save_topology = true

# Optional index name and HTTP path
# Optional index name. By default is packetbeat and generates [packetbeat-]YYYY.MM.DD keys.
# index = "packetbeat"

# Optional HTTP Path
# path = "/elasticsearch"


Expand All @@ -44,8 +46,7 @@
# Comment out this option if you want to store the topology in Redis. By default is false.
save_topology = true

# Optional index name. By default is packetbeat and generates
# keys of type [packetbeat-]YYYY.MM.DD.
# Optional index name. By default is packetbeat and generates packetbeat keys.
# index = "packetbeat"

# Optional Redis database number where the events are stored
Expand Down

0 comments on commit f023fbb

Please sign in to comment.