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 tls support for vmware vcenter #231

Merged
merged 6 commits into from
Feb 25, 2021
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Update `hadoop` plugin ([PR230](https://github.com/observIQ/stanza-plugins/pull/230))
- Remove `preserve_to` parameter from severity
- Update `vmware_vcenter` and `vmware_esxi` plugins ([PR231](https://github.com/observIQ/stanza-plugins/pull/231))
- Add support for TLS (requires Stanza v0.13.14 or newer)
## [0.0.47] - 2021-02-18
### Changed
- Update `mysql` plugin ([PR228](https://github.com/observIQ/stanza-plugins/pull/228))
Expand Down
32 changes: 31 additions & 1 deletion plugins/vmware_esxi.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Plugin Info
version: 0.0.6
version: 0.0.7
title: VMware ESXi
description: Log parser for VMware ESXi
parameters:
Expand All @@ -8,9 +8,35 @@ parameters:
description: A syslog address of the form `<ip>:<port>`
type: string
default: "0.0.0.0:5140"
- name: enable_tls
label: Enable TLS
description: Enable TLS for the TCP listener
type: bool
default: false
- name: certificate_file
label: TLS certificate path
description: File path for the X509 TLS certificate chain
type: string
default: "/opt/cert"
required: true
relevant_if:
enable_tls:
equals: true
- name: private_key_file
label: TLS private key path
description: File path for the X509 TLS certificate chain
type: string
default: "/opt/key"
required: true
relevant_if:
enable_tls:
equals: true

# Set Defaults
# {{$listen_address := default "0.0.0.0:5140" .listen_address}}
# {{$enable_tls := default true .enable_tls}}
# {{$certificate_file := default "" .certificate_file}}
# {{$private_key_file := default "" .private_key_file}}

# Pipeline Template
pipeline:
Expand All @@ -20,6 +46,10 @@ pipeline:
labels:
log_type: vmware_esxi
plugin_id: {{ .id }}
tls:
enable: {{ $enable_tls }}
certificate: {{ $certificate_file }}
private_key: {{ $private_key_file }}
output: timestamp_router
- id: timestamp_router
type: router
Expand Down
56 changes: 55 additions & 1 deletion plugins/vmware_vcenter.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Plugin Info
version: 0.0.4
version: 0.0.5
title: VMware vCenter
description: Log parser for VMware vCenter
parameters:
Expand All @@ -8,9 +8,35 @@ parameters:
description: A syslog address of the form `<ip>:<port>`
type: string
default: "0.0.0.0:5140"
- name: enable_tls
label: Enable TLS
description: Enable TLS for the TCP listener
type: bool
default: false
- name: certificate_file
label: TLS certificate path
description: File path for the X509 TLS certificate chain
type: string
default: "/opt/cert"
required: true
relevant_if:
enable_tls:
equals: true
- name: private_key_file
label: TLS private key path
description: File path for the X509 TLS certificate chain
type: string
default: "/opt/key"
required: true
relevant_if:
enable_tls:
equals: true

# Set Defaults
# {{$listen_address := default "0.0.0.0:5140" .listen_address}}
# {{$enable_tls := default true .enable_tls}}
# {{$certificate_file := default "" .certificate_file}}
# {{$private_key_file := default "" .private_key_file}}

# Pipeline Template
pipeline:
Expand All @@ -20,6 +46,34 @@ pipeline:
labels:
log_type: vmware_vcenter
plugin_id: {{ .id }}
tls:
enable: {{ $enable_tls }}
certificate: {{ $certificate_file }}
private_key: {{ $private_key_file }}
output: prefix_router

# vcenter will (sometimes) prepend an id to the messages, check
# for the id and drop it if it exsits
# example: '257 <14>1. . . '
- id: prefix_router
type: router
routes:
- expr: '$record matches "^\\d* "'
output: pre_parser
default: vcenter_parser

- id: pre_parser
type: regex_parser
regex: '^(?P<drop>\d* )(?P<syslog_message>[\w\W]*)'
output: pre_parser_restructure

- id: pre_parser_restructure
type: restructure
ops:
- remove: "$record.drop"
- move:
from: "$record.syslog_message"
to: "$record"
output: vcenter_parser

- id: vcenter_parser
Expand Down