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

Filebeat envoyproxy module #11700

Merged
merged 22 commits into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from 16 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.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- New Filebeat coredns module to ingest coredns logs. It supports both native coredns deployment and coredns deployment in kubernetes. {pull}11200[11200]
- New module for Cisco ASA logs. {issue}9200[9200] {pull}11171[11171]
- Added support for Cisco ASA fields to the netflow input. {pull}11201[11201]
- Add Filebeat envoyproxy module. {pull}11700[11700]

*Heartbeat*

Expand Down
77 changes: 77 additions & 0 deletions filebeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ grouped in the following categories:
* <<exported-fields-docker-processor>>
* <<exported-fields-ecs>>
* <<exported-fields-elasticsearch>>
* <<exported-fields-envoyproxy>>
* <<exported-fields-haproxy>>
* <<exported-fields-host-processor>>
* <<exported-fields-icinga>>
Expand Down Expand Up @@ -5355,6 +5356,82 @@ example: doc

Type

--

[[exported-fields-envoyproxy]]
== Envoyproxy fields

Module for handling logs produced by envoy



[float]
== envoyproxy fields

Fields from envoy proxy logs after normalization



*`envoyproxy.log_type`*::
+
--
type: keyword

Envoy log type, normally ACCESS


--

*`envoyproxy.response_flags`*::
+
--
type: keyword

Response flags


--

*`envoyproxy.upstream_service_time`*::
+
--
type: long

format: duration

Upstream service time in nanoseconds


--

*`envoyproxy.request_id`*::
+
--
type: keyword

ID of the request


--

*`envoyproxy.authority`*::
+
--
type: keyword

Envoy proxy authority field


--

*`envoyproxy.proxy_type`*::
+
--
type: keyword

Envoy proxy type, tcp or http


--

[[exported-fields-haproxy]]
Expand Down
Binary file added filebeat/docs/images/kibana-envoyproxy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions filebeat/docs/modules/envoyproxy.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
////
This file is generated! See scripts/docs_collector.py
////

[[filebeat-module-envoyproxy]]
[role="xpack"]

:modulename: envoyproxy
:has-dashboards: true

== Envoyproxy Module

This is a filebeat module for envoy proxy. It supports both standalone deployment and
envoy proxy deployment in Kubernetes.

[float]
=== Compatibility

Although this module has been developed against Kubernetes v1.13.x, it is expected to work
alakahakai marked this conversation as resolved.
Show resolved Hide resolved
with other versions of Kubernetes.

[float]
=== Example dashboard

This module comes with a sample dashboard.

[role="screenshot"]
image::./images/kibana-envoyproxy.jpg[]


[float]
=== Fields

For a description of each field in the module, see the
<<exported-fields-envoyproxy,exported fields>> section.

2 changes: 2 additions & 0 deletions filebeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This file is generated! See scripts/docs_collector.py
* <<filebeat-module-cisco>>
* <<filebeat-module-coredns>>
* <<filebeat-module-elasticsearch>>
* <<filebeat-module-envoyproxy>>
* <<filebeat-module-haproxy>>
* <<filebeat-module-icinga>>
* <<filebeat-module-iis>>
Expand Down Expand Up @@ -38,6 +39,7 @@ include::modules/auditd.asciidoc[]
include::modules/cisco.asciidoc[]
include::modules/coredns.asciidoc[]
include::modules/elasticsearch.asciidoc[]
include::modules/envoyproxy.asciidoc[]
include::modules/haproxy.asciidoc[]
include::modules/icinga.asciidoc[]
include::modules/iis.asciidoc[]
Expand Down
10 changes: 10 additions & 0 deletions x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ filebeat.modules:
#var.convert_timezone: false


#------------------------------ Envoyproxy Module ------------------------------
- module: envoyproxy
# Fileset for native deployment
log:
enabled: true

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

#------------------------------- Haproxy Module -------------------------------
- module: haproxy
# All logs
Expand Down
1 change: 1 addition & 0 deletions x-pack/filebeat/include/list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 128 additions & 0 deletions x-pack/filebeat/module/envoyproxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Envoyproxy Module

This is a filebeat module for envoy proxy.

## Caveats

* Module is to be considered _beta_.

## Download and install Filebeat

Grab the filebeat binary from elastic.co, and install it by following the instructions.

## Deployment Scenario #1: envoy native deployment

Make sure to update envoy configuration to enable log plugin. This module assumes that envoy log
alakahakai marked this conversation as resolved.
Show resolved Hide resolved
entries will be written to /var/log/envoy.log. Should it be not the case, please point the module
log path to the path of the log file.

Update filebeat.yml to point to Elasticsearch and Kibana.
Setup Filebeat.
```
./filebeat setup --modules envoyproxy -e
```

Enable the Filebeat envoyproxy module
```
./filebeat modules enable envoyproxy
```

Start Filebeat
```
./filebeat -e
```

Now, the Envoy logs and dashboard should appear in Kibana.


## Deployment Scenario #2: envoy for kubernetes

For Kubernetes deployment, the filebeat daemon-set yaml file needs to be deployed to the
Kubernetes cluster. Sample configuration files is provided under the `beats/deploy/filebeat`
alakahakai marked this conversation as resolved.
Show resolved Hide resolved
directory, and can be deployed by doing the following:
```
kubectl apply -f filebeat
```

#### Note the following section in the ConfigMap, make changes to the yaml file if necessary
```
filebeat.autodiscover:
providers:
- type: kubernetes
hints.enabled: true
default.disable: true

processors:
- add_kubernetes_metadata:
in_cluster: true
```

This enables auto-discovery and hints for filebeat. When default.disable is set to true (default value is false), it will disable log harvesting for the pod/container, unless it has specific annotations enabled. This gives users more granular control on kubernetes log ingestion. The `add_kubernetes_metadata` processor will add enrichment data for Kubernetes to the ingest logs.

#### Note the following section in the DaemonSet, make changes to the yaml file if necessary
```
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: filebeat
namespace: kube-system
labels:
k8s-app: filebeat
spec:
template:
metadata:
labels:
k8s-app: filebeat
spec:
serviceAccountName: filebeat
terminationGracePeriodSeconds: 30
containers:
- name: filebeat
image: docker.elastic.co/beats/filebeat:%VERSION%
args: [
"sh", "-c", "filebeat setup -e --modules envoyproxy -c /etc/filebeat.yml && filebeat -e -c /etc/filebeat.yml"
]
env:
# Edit the following values to reflect your setup accordingly
- name: ELASTICSEARCH_HOST
value: 192.168.99.1
- name: ELASTICSEARCH_USERNAME
value: elastic
- name: ELASTICSEARCH_PASSWORD
value: changeme
- name: KIBANA_HOST
value: 192.168.99.1
```

The module setup step can also be done separately without Kubernetes if applicable, and in that case, the args can be simplified to:
```
args: [
"sh", "-c", "filebeat -e -c /etc/filebeat.yml"
]
```

#### Sample Deployment for envoy, using ambassador as an example. Note the annotations.
alakahakai marked this conversation as resolved.
Show resolved Hide resolved

```
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ambassador
spec:
replicas: 3
template:
metadata:
annotations:
"co.elastic.logs/module": "envoyproxy"
"co.elastic.logs/fileset": "log"
"co.elastic.logs/disable": "false"
labels:
service: ambassador
spec:
serviceAccountName: ambassador
containers:
- name: ambassador
image: quay.io/datawire/ambassador:0.50.0
<snipped>
```

8 changes: 8 additions & 0 deletions x-pack/filebeat/module/envoyproxy/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- module: envoyproxy
# Fileset for native deployment
log:
enabled: true

# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths:
23 changes: 23 additions & 0 deletions x-pack/filebeat/module/envoyproxy/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[role="xpack"]

:modulename: envoyproxy
:has-dashboards: true

== Envoyproxy Module

This is a filebeat module for envoy proxy. It supports both standalone deployment and
alakahakai marked this conversation as resolved.
Show resolved Hide resolved
envoy proxy deployment in Kubernetes.

[float]
=== Compatibility

Although this module has been developed against Kubernetes v1.13.x, it is expected to work
with other versions of Kubernetes.

[float]
=== Example dashboard

This module comes with a sample dashboard.

[role="screenshot"]
image::./images/kibana-envoyproxy.jpg[]
45 changes: 45 additions & 0 deletions x-pack/filebeat/module/envoyproxy/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
- key: envoyproxy
title: Envoyproxy
description: >
Module for handling logs produced by envoy
fields:
- name: envoyproxy
type: group
description: >
Fields from envoy proxy logs after normalization
fields:
- name: log_type
type: keyword
description: >
Envoy log type, normally ACCESS

- name: response_flags
type: keyword
description: >
Response flags

- name: upstream_service_time
type: long
format: duration
input_format: nanoseconds
description: >
Upstream service time in nanoseconds

- name: request_id
type: keyword
description: >
ID of the request

- name: authority
type: keyword
description: >
Envoy proxy authority field

- name: proxy_type
type: keyword
description: >
Envoy proxy type, tcp or http




Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading