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

User facing documentation for Logstash on ECK #6585

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7a57bbd
Harden Elasticsearch SecurityContext (#6703)
barkbay Apr 27, 2023
326eb00
[Fleet] Deprecate is_default and is_default_fleet_server flags (#6724)
barkbay Apr 27, 2023
f148a3c
Update modules go.elastic.co/apm/* to v2.4.1 (#6739)
renovate[bot] Apr 28, 2023
b6b5075
Introduce the Logstash operator for ECK (#6732)
robbavey Apr 28, 2023
294f302
Fix default `elasticsearch-data` volumeMount configuration (#6725)
thbkrkr Apr 28, 2023
d9b4774
Add operator flag to define global container repository (#6737)
thbkrkr Apr 28, 2023
e679b5f
Update Logstash stack mon tests (#6741)
thbkrkr Apr 28, 2023
0b7a58a
First pass
robbavey Mar 21, 2023
4f1b102
Added more logstash docs
robbavey Mar 24, 2023
b2e00d4
Add Logstash Recipes
robbavey Mar 24, 2023
90683af
Tidy up readme
robbavey Mar 24, 2023
9ecb8cd
Added more doc
robbavey Mar 28, 2023
d14faf0
Improvements
robbavey Mar 28, 2023
f9ba1ff
add recipes for ElasticsearchRefs
kaisecheng Apr 20, 2023
38de4dd
Responded to code review comments
robbavey Apr 3, 2023
a29d9f0
Updates for elasticsearchRef. A little tidying
robbavey Apr 24, 2023
f07d6ce
Add role information to elasticsearch integration
robbavey Apr 24, 2023
2f45d19
Fix env variable names in example snippets
robbavey Apr 24, 2023
add2f2c
Fix recipes
robbavey Apr 25, 2023
7aa2a6c
Add intro to elasticsearchref example
robbavey Apr 25, 2023
5872086
Remove duplicate recipe reference.
robbavey Apr 26, 2023
6ceb4f9
Add the new file to the landing page
alaudazzi Apr 28, 2023
e98acfe
Apply suggestions from code review
robbavey Apr 28, 2023
301a554
Tidy up recipes after code review comments
robbavey Apr 28, 2023
232d61b
More code review suggestions
robbavey Apr 28, 2023
c3b9007
Missed capitalization
robbavey Apr 28, 2023
353cac7
Merge remote-tracking branch 'upstream/main' into logstash_doc
robbavey Apr 28, 2023
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
24 changes: 12 additions & 12 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2914,11 +2914,11 @@ SOFTWARE.

--------------------------------------------------------------------------------
Module : go.elastic.co/apm/module/apmelasticsearch/v2
Version : v2.3.0
Time : 2023-03-31T03:30:00Z
Version : v2.4.1
Time : 2023-04-27T13:39:08Z
Licence : Apache-2.0

Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmelasticsearch/v2@v2.3.0/LICENSE:
Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmelasticsearch/v2@v2.4.1/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -3125,11 +3125,11 @@ Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmelasti

--------------------------------------------------------------------------------
Module : go.elastic.co/apm/module/apmhttp/v2
Version : v2.3.0
Time : 2023-03-31T03:30:00Z
Version : v2.4.1
Time : 2023-04-27T13:39:08Z
Licence : Apache-2.0

Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmhttp/v2@v2.3.0/LICENSE:
Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmhttp/v2@v2.4.1/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -3336,11 +3336,11 @@ Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmhttp/v

--------------------------------------------------------------------------------
Module : go.elastic.co/apm/module/apmzap/v2
Version : v2.3.0
Time : 2023-03-31T03:30:00Z
Version : v2.4.1
Time : 2023-04-27T13:39:08Z
Licence : Apache-2.0

Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmzap/v2@v2.3.0/LICENSE:
Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmzap/v2@v2.4.1/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -3547,11 +3547,11 @@ Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/module/apmzap/v2

--------------------------------------------------------------------------------
Module : go.elastic.co/apm/v2
Version : v2.3.0
Time : 2023-03-31T03:30:00Z
Version : v2.4.1
Time : 2023-04-27T13:39:08Z
Licence : Apache-2.0

Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/v2@v2.3.0/LICENSE:
Contents of probable licence file $GOMODCACHE/go.elastic.co/apm/v2@v2.4.1/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down
12 changes: 12 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ func Command() *cobra.Command {
container.DefaultContainerRegistry,
"Container registry to use when downloading Elastic Stack container images",
)
cmd.Flags().String(
operator.ContainerRepositoryFlag,
"",
"Container repository to use when downloading Elastic Stack container images",
)
cmd.Flags().String(
operator.ContainerSuffixFlag,
"",
Expand Down Expand Up @@ -474,6 +479,13 @@ func startOperator(ctx context.Context) error {
log.Info("Setting default container registry", "container_registry", containerRegistry)
container.SetContainerRegistry(containerRegistry)

// set the default container repository
containerRepository := viper.GetString(operator.ContainerRepositoryFlag)
if containerRepository != "" {
log.Info("Setting default container repository", "container_repository", containerRepository)
container.SetContainerRepository(containerRepository)
}

// allow users to specify a container suffix unless --ubi-only mode is active
suffix := viper.GetString(operator.ContainerSuffixFlag)
if len(suffix) > 0 {
Expand Down
6 changes: 3 additions & 3 deletions config/crds/v1/all-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,9 @@ spec:
- fleet
type: string
policyID:
description: PolicyID optionally determines into which Agent Policy
this Agent will be enrolled. If left empty the default policy will
be used.
description: PolicyID determines into which Agent Policy this Agent
will be enrolled. This field will become mandatory in a future release,
default policies are deprecated since 8.1.0.
type: string
revisionHistoryLimit:
description: RevisionHistoryLimit is the number of revisions to retain
Expand Down
6 changes: 3 additions & 3 deletions config/crds/v1/bases/agent.k8s.elastic.co_agents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16310,9 +16310,9 @@ spec:
- fleet
type: string
policyID:
description: PolicyID optionally determines into which Agent Policy
this Agent will be enrolled. If left empty the default policy will
be used.
description: PolicyID determines into which Agent Policy this Agent
will be enrolled. This field will become mandatory in a future release,
default policies are deprecated since 8.1.0.
type: string
revisionHistoryLimit:
description: RevisionHistoryLimit is the number of revisions to retain
Expand Down
4 changes: 2 additions & 2 deletions config/recipes/elastic-agent/fleet-apm-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ spec:
xpack.fleet.agentPolicies:
- name: Fleet Server on ECK policy
id: eck-fleet-server
is_default_fleet_server: true
namespace: default
monitoring_enabled:
- logs
Expand All @@ -40,7 +39,6 @@ spec:
- logs
- metrics
unenroll_timeout: 900
is_default: true
package_policies:
- name: system-1
id: system-1
Expand Down Expand Up @@ -80,6 +78,7 @@ spec:
- name: elasticsearch
mode: fleet
fleetServerEnabled: true
policyID: eck-fleet-server
deployment:
replicas: 1
podTemplate:
Expand All @@ -100,6 +99,7 @@ spec:
fleetServerRef:
name: fleet-server
mode: fleet
policyID: eck-agent
deployment:
replicas: 1
podTemplate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ spec:
- logs
- metrics
unenroll_timeout: 900
is_default_fleet_server: true
package_policies:
- name: fleet_server-1
id: fleet_server-1
Expand All @@ -39,8 +38,7 @@ spec:
monitoring_enabled:
- logs
- metrics
unenroll_timeout: 900
is_default: true
unenroll_timeout: 900
package_policies:
- name: system-1
id: system-1
Expand Down Expand Up @@ -89,6 +87,7 @@ spec:
- name: elasticsearch
mode: fleet
fleetServerEnabled: true
policyID: eck-fleet-server
deployment:
replicas: 1
podTemplate:
Expand All @@ -109,6 +108,7 @@ spec:
fleetServerRef:
name: fleet-server
mode: fleet
policyID: eck-agent
daemonSet:
podTemplate:
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ spec:
- logs
- metrics
unenroll_timeout: 900
is_default_fleet_server: true
package_policies:
- name: fleet_server-1
id: fleet_server-1
Expand All @@ -40,7 +39,6 @@ spec:
- logs
- metrics
unenroll_timeout: 900
is_default: true
package_policies:
- package:
name: system
Expand Down Expand Up @@ -73,6 +71,7 @@ spec:
- name: elasticsearch
mode: fleet
fleetServerEnabled: true
policyID: eck-fleet-server
deployment:
replicas: 1
podTemplate:
Expand All @@ -93,6 +92,7 @@ spec:
fleetServerRef:
name: fleet-server
mode: fleet
policyID: eck-agent
daemonSet:
podTemplate:
spec:
Expand Down
24 changes: 22 additions & 2 deletions config/recipes/logstash/README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,27 @@ endif::[]

= Using Logstash with ECK

This recipe demonstrates how to run the link:https://www.elastic.co/guide/en/logstash/current/advanced-pipeline.html[Logstash log parsing example] on Kubernetes with Elasticsearch, Kibana and Filebeat deployed via ECK.
These recipes demonstrate how to run Logstash, Elasticsearch, Kibana and Filebeat deployed via ECK, using the link:https://www.elastic.co/guide/en/logstash/current/advanced-pipeline.html[Logstash log parsing example] as a starting point.

===== Inline Pipeline usage - `logstash-eck.yaml`

Deploys Logstash with the pipeline defined inline in the CRD.

===== Pipeline as Secret - `logstash-pipeline-as-secret.yaml`

Deploys Logstash with the pipeline defined in a Secret and referred to via `pipelinesRef`.

===== Pipeline as mounted volume - `logstash-pipeline-as-volume.yaml`

Deploys Logstash with the pipeline details defined in the CRD, and the pipeline itself mounted as a volume.

===== Logstash with Stack Monitoring - `logstash-monitored.yaml`

Deploys Logstash and a dedicated Elasticsearch and Kibana monitoring cluster, and sends Logstash monitoring data to that cluster.

===== Logstash and Elasticsearch with custom role - `logstash-es-role.yaml`

Deploys Logstash and Elasticsearch and a Secret to customize Elasticsearch role `eck_logstash_user_role`. The role is essential for Logstash to have privileges to write document to custom index "my-index".

CAUTION: These recipes use the `node.store.allow_mmap: false` configuration value to avoid configuring memory mapping settings on the underlying host. This could have a significant performance impact on your Elasticsearch cluster and should not be used in production without careful consideration. See https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html for more information.

CAUTION: This recipe uses the `node.store.allow_mmap: false` configuration value to avoid configuring memory mapping settings on the underlying host. This could have a significant performance impact on your Elasticsearch cluster and should not be used in production without careful consideration. See https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html for more information.
108 changes: 108 additions & 0 deletions config/recipes/logstash/logstash-eck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
robbavey marked this conversation as resolved.
Show resolved Hide resolved
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: elasticsearch
spec:
version: 8.7.0
nodeSets:
- name: default
count: 3
config:
# This setting has performance implications. See the README for more details.
node.store.allow_mmap: false
---
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
name: kibana
spec:
version: 8.7.0
count: 1
elasticsearchRef:
name: elasticsearch
---
apiVersion: beat.k8s.elastic.co/v1beta1
kind: Beat
metadata:
name: filebeat
spec:
type: filebeat
version: 8.7.0
config:
filebeat.inputs:
- type: log
paths:
- /data/logstash-tutorial.log
output.logstash:
hosts: ["logstash-ls-api.default.svc:5044"]
deployment:
podTemplate:
spec:
automountServiceAccountToken: true
initContainers:
- name: download-tutorial
image: curlimages/curl
command: ["/bin/sh"]
args: ["-c", "curl -L https://download.elastic.co/demos/logstash/gettingstarted/logstash-tutorial.log.gz | gunzip -c > /data/logstash-tutorial.log"]
volumeMounts:
- name: data
mountPath: /data
containers:
- name: filebeat
volumeMounts:
- name: data
mountPath: /data
- name: beat-data
mountPath: /usr/share/filebeat/data
volumes:
- name: data
emptydir: {}
- name: beat-data
emptydir: {}
---
apiVersion: logstash.k8s.elastic.co/v1alpha1
kind: Logstash
metadata:
name: logstash
spec:
count: 1
version: 8.7.0
elasticsearchRefs:
- clusterName: eck
name: elasticsearch
pipelines:
- pipeline.id: main
config.string: |
input {
beats {
port => 5044
}
}
filter {
grok {
match => { "message" => "%{HTTPD_COMMONLOG}"}
}
geoip {
source => "[source][address]"
target => "[source]"
}
}
output {
elasticsearch {
hosts => [ "${ECK_ES_HOSTS}" ]
user => "${ECK_ES_USER}"
password => "${ECK_ES_PASSWORD}"
cacert => "${ECK_ES_SSL_CERTIFICATE_AUTHORITY}"
}
}
services:
- name: beats
service:
spec:
type: ClusterIP
ports:
- port: 5044
name: "filebeat"
protocol: TCP
targetPort: 5044
Loading