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

Add pattern option in the fields.yml #4731

Merged
merged 1 commit into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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