Skip to content

Commit

Permalink
Add pattern option in the fields.yml to be used in case of a number
Browse files Browse the repository at this point in the history
  • Loading branch information
monicasarbu committed Jul 21, 2017
1 parent c1bd89b commit f0619ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ https://github.com/elastic/beats/compare/v6.0.0-alpha2...master[Check the HEAD d
- Enable pipelining in Logstash output by default. {pull}4650[4650]
- Added 'result' field to Elasticsearch QueryResult struct for compatibility with 6.x Index and Delete API responses. {issue]4661[4661]
- The sample dashboards are now included in the Beats packages. {pull}4675[4675]
- Add `pattern` option to be used in the fields.yml to specify the pattern for a number field. {pull}4731[4731]

*Filebeat*

Expand Down
16 changes: 12 additions & 4 deletions libbeat/scripts/generate_index_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,18 @@ def field_to_json(fields, desc, path, output,

output["fields"].append(field)

if "format" in desc:
output["fieldFormatMap"][path] = {
"id": desc["format"],
}
if "format" in desc or "pattern" in desc:
fieldFormat = {}

if "format" in desc:
fieldFormat["id"] = desc["format"]

if "pattern" in desc:
fieldFormat["params"] = {
"pattern": desc["pattern"]
}

output["fieldFormatMap"][path] = fieldFormat


def fields_to_index_pattern(version, args, input):
Expand Down

0 comments on commit f0619ce

Please sign in to comment.