Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

added support for 'replace_dot_with' flag in ES encoders #1947

Merged
merged 3 commits into from
Jun 11, 2016

Conversation

jxstanford
Copy link
Contributor

This PR adds a new replace_dots_with parameter to ESJsonEncoder and ESLogstashV0Encoder. The parameter value is a string that will be substituted for all . characters in all keys of the unmarshalled JSON value found in the message Payload. Tests have been updated accordingly.

Here is an example encoder config:

[ESJsonEncoder]
index = "gke-%{Logger}-%{%Y.%m.%d}"
es_index_from_timestamp = false
type_name = "%{Type}"
replace_dots_with = "_"

Closes: #1946

if !first {
b.WriteString(`,`)
}

writeQuotedString(b, f.GetName())
if replaceDotsWith != "." {
writeQuotedString(b, replaceDots(f.GetName(), replaceDotsWith))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the value of replaceDotsWith function is over the stdlib's strings.Replace:

strings.Replace(f.GetName(), ".", replaceDotsWith, -1)

@rafrombrc
Copy link
Contributor

Thanks for your contribution. In addition to the inline comment I made, you'll want to update the documentation (see esjson.rst and eslogstashv0.rst files in the docs/source/config/encoders folder) and add an entry to the CHANGES.txt changelog.

@jxstanford
Copy link
Contributor Author

@rafrombrc no problem. really excited about working with Heka. all comments addressed...

@rafrombrc
Copy link
Contributor

Great, thanks!

@rafrombrc rafrombrc merged commit e879938 into mozilla-services:dev Jun 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants