Skip to content

Commit

Permalink
Add convert_timezone to nginx module (elastic#10148)
Browse files Browse the repository at this point in the history
* Add convert_timezone to nginx module

* Run mage fmt update on x-pack filebeat
  • Loading branch information
kaiyan-sheng committed Jan 21, 2019
1 parent 94e58e9 commit d53fa9f
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Elasticsearch module's slowlog now populates `event.duration` (ECS). {pull}9293[9293]
- HAProxy module now populates `event.duration` and `http.response.bytes` (ECS). {pull}10143[10143]
- Teach elasticsearch/audit fileset to parse out some more fields. {issue}10134[10134] {pull}10137[10137]
- Add convert_timezone to nginx module. {issue}9839[9839] {pull}10148[10148]

*Heartbeat*

Expand Down
6 changes: 6 additions & 0 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ filebeat.modules:
# can be added under this section.
#input:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: false

# Error logs
#error:
#enabled: true
Expand All @@ -316,6 +319,9 @@ filebeat.modules:
# can be added under this section.
#input:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: false

#------------------------------- Osquery Module -------------------------------
- module: osquery
result:
Expand Down
6 changes: 6 additions & 0 deletions filebeat/module/nginx/_meta/config.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# can be added under this section.
#input:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: false

# Error logs
#error:
#enabled: true
Expand All @@ -22,3 +25,6 @@
# Input configuration (advanced). Any input configuration option
# can be added under this section.
#input:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: false
6 changes: 6 additions & 0 deletions filebeat/module/nginx/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
# Filebeat will choose the paths depending on your OS.
#var.paths:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: true

# Error logs
error:
enabled: true

# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: true
5 changes: 5 additions & 0 deletions filebeat/module/nginx/access/config/nginx-access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ paths:
- {{$path}}
{{ end }}
exclude_files: [".gz$"]

{{ if .convert_timezone }}
processors:
- add_locale: ~
{{ end }}
4 changes: 3 additions & 1 deletion filebeat/module/nginx/access/ingest/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
"target_field": "@timestamp",
"formats": [
"dd/MMM/YYYY:H:m:s Z"
]
],
{< if .convert_timezone >}"timezone": "{{ event.timezone }}",{< end >}
"ignore_failure": true
}
},
{
Expand Down
7 changes: 7 additions & 0 deletions filebeat/module/nginx/access/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ var:
- /usr/local/var/log/nginx/access.log*
os.windows:
- c:/programdata/nginx/logs/*access.log*
- name: convert_timezone
default: false
# if ES < 6.1.0, this flag switches to false automatically when evaluating the
# pipeline
min_elasticsearch_version:
version: 6.1.0
value: false

ingest_pipeline: ingest/default.json
input: config/nginx-access.yml
Expand Down
5 changes: 5 additions & 0 deletions filebeat/module/nginx/error/config/nginx-error.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ paths:
- {{$path}}
{{ end }}
exclude_files: [".gz$"]

{{ if .convert_timezone }}
processors:
- add_locale: ~
{{ end }}
4 changes: 3 additions & 1 deletion filebeat/module/nginx/error/ingest/pipeline.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"date": {
"field": "nginx.error.time",
"target_field": "@timestamp",
"formats": ["YYYY/MM/dd H:m:s"]
"formats": ["YYYY/MM/dd H:m:s"],
{< if .convert_timezone >}"timezone": "{{ event.timezone }}",{< end >}
"ignore_failure": true
}
}, {
"remove": {
Expand Down
7 changes: 7 additions & 0 deletions filebeat/module/nginx/error/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ var:
- /usr/local/var/log/nginx/error.log*
os.windows:
- c:/programdata/nginx/logs/error.log*
- name: convert_timezone
default: false
# if ES < 6.1.0, this flag switches to false automatically when evaluating the
# pipeline
min_elasticsearch_version:
version: 6.1.0
value: false

ingest_pipeline: ingest/pipeline.json
input: config/nginx-error.yml
6 changes: 6 additions & 0 deletions filebeat/modules.d/nginx.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
# Filebeat will choose the paths depending on your OS.
#var.paths:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: true

# Error logs
error:
enabled: true

# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: true
6 changes: 6 additions & 0 deletions x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ filebeat.modules:
# can be added under this section.
#input:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: false

# Error logs
#error:
#enabled: true
Expand All @@ -316,6 +319,9 @@ filebeat.modules:
# can be added under this section.
#input:

# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1.
#var.convert_timezone: false

#------------------------------- Osquery Module -------------------------------
- module: osquery
result:
Expand Down

0 comments on commit d53fa9f

Please sign in to comment.