Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gelf: parsing extra fields and removing type field #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions beater/protologbeat.go
Expand Up @@ -59,9 +59,6 @@ func (bt *Protologbeat) Run(b *beat.Beat) error {
if event == nil {
return nil
}
if _, ok := event["type"]; !ok {
event["type"] = bt.config.DefaultEsLogType
}
bt.client.PublishEvent(event)
logp.Info("Event sent")
}
Expand Down
2 changes: 0 additions & 2 deletions config/config.go
Expand Up @@ -13,7 +13,6 @@ type Config struct {
MaxMsgSize int `config:"max_msg_size"`
JsonMode bool `config:"json_mode"`
EnableGelf bool `config:"enable_gelf"`
DefaultEsLogType string `config:"default_es_log_type"`
MergeFieldsToRoot bool `config:"merge_fields_to_root"`
EnableSyslogFormatOnly bool `config:"enable_syslog_format_only"`
EnableJsonValidation bool `config:"enable_json_validation"`
Expand All @@ -30,7 +29,6 @@ var DefaultConfig = Config{
MaxMsgSize: 4096,
JsonMode: false,
EnableGelf: false,
DefaultEsLogType: "protologbeat",
MergeFieldsToRoot: false,
EnableSyslogFormatOnly: false,
EnableJsonValidation: false,
Expand Down
5 changes: 4 additions & 1 deletion protolog/loglistener.go
Expand Up @@ -232,10 +232,13 @@ func (ll *LogListener) processGelfMessage(msg *gelf.Message) {
event := common.MapStr{}
event["gelf"] = map[string]interface{}{"version": msg.Version}
event["host"] = msg.Host
event["type"] = ll.config.DefaultEsLogType
event["short_message"] = msg.Short
event["full_message"] = msg.Full

for name,value := range msg.Extra {
event[name] = value
}

// 1 ms = 1000000 ns
if msg.TimeUnix == 0 {
event["@timestamp"] = common.Time(time.Now())
Expand Down
5 changes: 1 addition & 4 deletions protologbeat.full.yml
Expand Up @@ -17,10 +17,7 @@ protologbeat:

# Enable accepting on JSON formated messages
#json_mode: true

# Default elasticsearch type to use if no type is present in the message
#default_es_log_type: protologbeat


# Wether to place the parsed json data at the root level or nested in a 'log' object
#merge_fields_to_root: true

Expand Down