Commit graph

82 commits

Author SHA1 Message Date
João Duarte
1484614405
Wolfi-based image flavor (#16189)
* Add wolfi as an option to the build process
* Add docker acceptance tests for the wolfi image
* Change how tests are done on the java process, due to "ps -C" not being available on wolfi

replaces and closes https://github.com/elastic/logstash/pull/16116

Co-authored-by: Andres Rodriguez <andreserl@gmail.com>
2024-06-17 15:48:02 +01:00
Andrea Selva
830733d758
Provide opt-in flag to avoid fields name clash when log format is json (#15969)
Adds log.format.json.fix_duplicate_message_fields feature flag to rename the clashing fields when json logging format (log.format) is selected.
In case two message fields clashes on structured log message, then the second is renamed attaching _1 suffix to the field name.
By default the feature is disabled and requires user to explicitly enable the behaviour.

Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
2024-04-17 16:37:05 +02:00
Rob Bavey
b9b9ad9395
Use dpkg --print-architecture in Dockerfile to ascertain architecture (#16076)
* Use `dpkg --print-architecture` in Dockerfile to ascertain architecture
2024-04-12 15:47:34 -04:00
Rob Bavey
e5b2b3d92b
Update Dockerfile to select appropriate architecture on build box (#16053)
This commit adds logic to copy the appropriate env2yaml file to the Docker image
* Clean up env2yaml folder

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2024-04-04 18:15:54 -04:00
kaisecheng
a7779664af
Modernize ironbank Dockerfile (#16022)
- remove golang assets (go1.17.8.linux-amd64.tar.gz)
- remove yaml lib assets (v2.3.0.tar.gz)
- use go container to build env2yaml
- remove unnecessary layers
- remove HEALTHCHECK
- switch yum to dnf

Fixes: elastic/ingest-dev#3008
2024-03-28 11:15:01 +00:00
Mashhur
e429795039
Save name came through ENV vars to let Logstash decide using value from either keystore or ENV. (#16026)
* Save  name came through ENV vars to let Logstash decide using either keystore or ENV value.

* Apply suggestions from code review to simplify array declaration.

Co-authored-by: kaisecheng <69120390+kaisecheng@users.noreply.github.com>

---------

Co-authored-by: kaisecheng <69120390+kaisecheng@users.noreply.github.com>
2024-03-27 09:22:27 -07:00
Rob Bavey
32052a263f
Remove curl installation step, as curl-minimal is already provided in ubi9 (#15998) 2024-03-12 09:50:52 -04:00
Rob Bavey
b640e7e851
Add arm64 support for env2yaml (#15980)
* Add arm64 support for env2yaml

This commit builds env2yaml in arm64 and amd64 flavors, and uses
$TARGETARCH in the Dockerfile to ensure that the correct version is used
when building for alternative architectures

Fixes: #15913

* Add env2yaml executables to build context

* Split `COPY_FILES` for readability

Co-authored-by: Andrea Selva <selva.andre@gmail.com>

---------

Co-authored-by: Andrea Selva <selva.andre@gmail.com>
2024-03-08 10:47:01 -05:00
kaisecheng
4e6815b1ea
add openssl to ubi image (#15929)
Logstash on ECK requires openssl command to build TLS keystore.
This commit adds `microdnf install -y openssl` to ensure the command exists in ubi image.
2024-02-09 18:40:02 +00:00
João Duarte
de01eb6ee3
Remove jinja2 in favor of erb templates (#15142)
This commit removes the jinja2 templates and consequently the dependency on Python
2024-02-09 13:49:58 +00:00
João Duarte
5c3e64d591
introduce go.mod for env2yaml (#15921)
Update the env2yaml to have a go.mod instead of relying on disabling go modules, otherwise building with golang 1.22 will fail in the future.
This change also directly uses the golang image to build the binary removing the need for an intermediate image.
2024-02-08 18:12:11 +00:00
Nassim Kammah
9256de43c3
Remove Nassim Kammah from list of maintainers (#15709) 2024-01-18 14:05:25 +01:00
Rob Bavey
a398c93eec
Update Iron Bank base image to ubi9.2 (#15490) 2023-10-26 09:53:29 -04:00
Rob Bavey
57cc392d0e
Update ubi8 base image to 8.7 (#15487) 2023-10-23 12:47:27 -04:00
Edmo Vamerlatti Costa
e76e582086
Add missing Elasticsearch SSL settings and replace deprecated options (xpack.monitoring and xpack.management) (#15045)
This commit adds missing Elasticsearch SSL settings and replaces deprecated options being used on `xpack.monitoring.*` and `xpack.management.*` settings:

Changes:
- Updated deprecated monitoring and management Elasticsearch's SSL settings so no warnings are logged.
- Added monitoring settings support for file-based certificates and for the cipher suites: `xpack.monitoring.elasticsearch.ssl.certificate`, `xpack.monitoring.elasticsearch.ssl.key`, and `xpack.monitoring.elasticsearch.ssl.cipher_suites`.
- Added management settings support for file-based certificates and for the cipher suites: `xpack.management.elasticsearch.ssl.certificate`, `xpack.management.elasticsearch.ssl.key`, and `xpack.management.elasticsearch.ssl.cipher_suites`.
2023-05-15 11:54:38 +02:00
kaisecheng
c99a7b2f46
Add env LOG_STYLE to control the log behavior (#14949)
This commit adds environment variable LOG_STYLE to control log behavior of docker container
`console` - this is the default to output to standout
`file` - log to disk.

Fixed: #14941
2023-03-08 23:25:33 +00:00
kaisecheng
46443e460d
Guard reserved tags field against incorrect use (#14822)
Reject illegal value assigning to `tags` field. Top-level `tags` should only accept string of array of string. 
When `tags` got illegal value on event creation, LogStash::Event will rename the field to `_tags` and add a tag `_tagsparsefailure` to `tags`. 
When `tags` got illegal value on `set` operation, LogStash::Event will throw exception.

Add a flag `--event_api.tags.illegal` to allow fallback to old logic. There are two options.
`warn` - the old flow that allows illegal value assignment to tags field.
`rename` - the new flow. This is the default value in 8.7

Co-authored-by: Ry Biesemeyer <ry.biesemeyer@elastic.co>
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2023-01-25 15:14:18 +00:00
Ry Biesemeyer
42ce9fc3e4
metrics: remove delayed implementation of timers interface (#14815)
The delayed implementation `AfterCompletionTimerMetric` of the `TimerMetric`
interface, introduced along-side that interface's introduction to replicate
the previous (undesired) behaviour, is superceded by an already-merged live-
tracking implementation that is effectively as performant when not under
concurrent contention and still reasonably performant when a single timer is
contended across multiple threads.

The `metric.timers` setting removed here has not been a part of any Logstash
release and can safely be removed without going through the normal deprecation
path; from the user's perspective this removal combined with the previously-
merged work is simply an improvement to the accuracy of the existing timer
metrics exposed via our API.
2023-01-12 15:31:09 -08:00
Edmo Vamerlatti Costa
e4dc82a9b3
Add setting to disable the GeoIP database downloader (#14823)
This commit adds a new logstash.yml setting "xpack.geoip.downloader.enabled" to disable the GeoIP databases auto-update feature. When disabled, Logstash will fall back to the CC database license indefinitely and delete any previously downloaded EULA databases.

Closes #14724
2023-01-05 15:46:35 +01:00
Rob Bavey
7e25a0d76a
Update Ironbank base image to 8.7 (#14812) 2022-12-16 10:12:09 -05:00
Ry Biesemeyer
e121650e56
live timers: API boundary, implementation, opt-in (#14748)
* live timers: introduce API boundary

Introduces an API boundary for timers as a first-class metric, as described
in elastic/logstash#14675, and migrates all known internal timers to use the
new API boundary for tracked execution.

Please refer to the specification for details on motivations.

This commit is net zero change to behaviour, and introduces a single new
undocumented setting `metric.timers` to `logstash.yml`, which presently only
takes its default value `delayed` to indicate that delayed committing of
execution time is acceptable.

It implements the new `TimerMetric` API in a way that is also net-zero-change.
Tracked executions are still performed by marking a start time, performing
the tracked execution, and incrementing an underlying long-type counter with
the number of elapsed milliseconds _after_ execution has completed. This means
that long-running execution is still missing from the metric until it has
completed.

The new Timer API is available to both the Ruby- and the Java-based plugin APIs

* timer metrics: sub-package and add baseline tests

* WIP: move execution metric ownership out of queue

* noop: remove useless abstract method

Our `AbstractMetric` implements `Metric` and does not need to declare
an abstract override of `Metric#getType`. Doing so prevents interfaces
from providing a default override for all implementers.

* timer metric tests: extract util, refactor for reuse

* timers: accumulate milli-excess-nanos

* live timers: single-checkpoint implementation

* timer metric: use explicit type parameters to make intent clear

* remove unused imports

* use safe int conversion

* test fixup: use given name for tested metric

* test helper: TimerMetricFactory prefers nanotime supplier

* timers: flesh out test coverage, incl live-timers

* test: move validation of queue-read metrics to ObservedExecution

* flow: support non-moving denominator (±infinity)

* metrics: add metric config pass-through to env2yaml
2022-12-13 13:35:53 -08:00
Rob Bavey
c124cc6c9e
Remove the chmod g+s command from ironbank docker image (#14435) 2022-08-16 10:10:06 -04:00
lior-orca
5767b3b986
Ensuring COPY instruction is used instead of ADD in Dockerfiles (#14423) 2022-08-12 14:59:52 +01:00
Boris Djurdjevic
f03330acd3
Add monitoring.cluster_uuid as Docker env setting(#14425)
Fix env2yaml tool to expose monitoring.cluster_uuid as Docker environment variable
2022-08-10 14:17:00 +02:00
Aaron Walker
c9d9f7c1a4
Add config.field_reference.escape_style to env2yaml (#14364) 2022-07-20 16:33:06 -04:00
Andrea Selva
be87b0b878
Implement DLQ age retention policy (#14255)
Updates DLQ writer's writeEvent method to clean the tail segments  older then the duration period. This happens only if setting dead_letter_queue.retain.age is configured.
To read the age of a segment it extract the timestamp of the last (youngest) message in the segment.

The age is defined as a number followed by one of d, h, m, s that stands for days, hours, minutes and seconds. If nothing is used then assumes seconds as default measure entity.

Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
2022-06-30 18:09:15 +02:00
Julien Mailleret
79c36c5ac2
Fix artifact path for integration with ubireleaser (#14319)
<artifact_path> need to be hardcoded so it can be replaced properly by
the ubireleaser during the creation of the Ironbank merge request.

Relates to https://github.com/elastic/logstash/pull/14298/
2022-06-30 16:21:08 +01:00
Ry Biesemeyer
7757908c34
Add ca_trusted_fingerprint to core features (monitoring/central-management) (#14155)
* add `ca_trusted_fingerprint` to core features (monitoring/central-management)

* Rely on released ES output

* fix: ensure commented-out examples in logstash.yml are functionally correct

* add admonition for how to get a trusted CA's fingerprint
2022-06-28 17:07:59 -07:00
kaisecheng
dfb109843d
Support ironbank docker build (#14298)
This commit adds a rake task `rake artifact:dockerfile_ironbank` to generate ironbank docker build context for automatic release.
The output can be found in build/logstash-ironbank-$VERSION-docker-build-context.tar.gz

Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
2022-06-28 10:29:55 +01:00
João Duarte
ce27e08eac
make retries in pip and go get extra shell compatible (#14282)
the use of ranges (e.g. {0..5}) or seq (e.g. $(seq 0 5)) may not
correctly in some systems, so let's just have a plain list of elements
for the loop to go through.
2022-06-21 09:41:11 +01:00
João Duarte
ff9f1e5a7f
improve resiliency of make venv and golang Dockerfile with retries (#14239)
This helps with transient network problems by not failing at the first try.

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>
2022-06-20 17:08:42 +01:00
Andres Rodriguez
0605b75420
[docs] Correctly reference the base OS (ubuntu) for docker (#14214)
* Fix docs to correctly reference the base OS (ubuntu) for docker
2022-06-09 10:00:02 -04:00
Mashhur
15dd1babf0
Simplifying HTTP basic password policy. (#14105)
* Simplifying HTTP basic password policy.
2022-05-23 21:11:10 -07:00
Mashhur
12162cbd80
Change on_superuser to run_as_superuser to clear a confusion. (#14089)
* Change on_superuser to run_as_superuser to clear a confusion.
2022-05-17 10:54:06 -07:00
Mashhur
d8e08e9f20
Add complex password policy on basic auth (#14045)
* Apply complex password policy on HTTP basic auth.
2022-05-03 09:57:46 -07:00
Mashhur
25796737c3
Prevent Logstash from running as root. (#14046)
* Prevent Logstash from running as root.

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-05-02 08:53:35 -07:00
Andrea Selva
c1fe7095c3
Implements DLQ storage policy (#13923)
Exposes dead_letter_queue.storage_policy configuration setting to explicitly enable the drop_older behavior in DLQs.

Moving from a drop_newer to a drop_older behavior has impact both on the writer side and to the reader side.
The implementation leverage the fact that a complete DLQ segment can be removed to free up space; on the writer side when the dead_letter_queue.max_bytes limit is reached it has to remove old segments.

On the reader side, the consuming has to be adapted to don't expect a continuous flow of segments, it could face an hole due to removal of tail segments.

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
2022-04-28 09:16:03 +02:00
Rob Bavey
11cf6a1974
Update logstash docker to use ubuntu 20.04 base image (#13442)
* Update logstash docker to use ubuntu 20.04 base image
* Correctly set locale for ubuntu docker image
* tiny typo fix: ubunto -> ubuntu

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2021-12-09 09:38:56 -05:00
Rob Bavey
2788e87a8c
Docker integration tests stability improvements (#13014)
* Docker integration tests stability improvements

This commit contains numerous fixes to improve the stability of the docker integration tests

* Patch Excon::UnixSocket

Socket.new running on arm64 on Ubuntu 18.04, causes an immediate SIGSEGV error and crash on
that OS, and, as far as I can tell, only that OS. `TCPSocket.new`,`UDPSocket.new` and
`UNIXSocket.new` do not. This commit patches the UnixSocket of the Excon library to
do the absolute simplest thing possible to avoid this error.

* Ensure that container is deleted even if #kill fails

* Add extra waits to handle the incremental way the payload returned by the monitoring
API increases as logstash starts up and pipelines load.

* Use pyenv to ensure the same version of python is used across different jenkins workers

* Add container logs to help diagnose failed test.

* Update the pipeline definition on multi-pipeline integration test

This was causing a pipeline to halt after startup causing intermittent test failures.

* Remove `;` to ensure failures are propagated appropriately

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2021-11-23 23:17:42 -05:00
Ry Biesemeyer
15930ccd3e
Secure API (#13308)
* settings: add "deprecated alias" support

A deprecated alias provides a path for renaming a setting.

 - When a deprecated alias is set on its own, a deprecation notice is emitted
   but fetching the canonical setting value will reflect the value set with the
   deprecated alias.
 - When both the canonical setting (new name) and the deprecated alias (old
   name) are specified, it is an error condition.
 - When the value of the deprecated alias is queried, a warning is emitted to
   the logger and only the value explicitly set to the deprecated alias is
   returned.

Additionally, some relevant cleanup is also included:

 - Starting Logstash with invalid settings no longer results in the obtuse "An
   unexpected error occurred" with backtrace and exception data obscuring the
   issue. Instead, a simple message is emitted indicating that the settings are
   invalid along with the originating exception's message.
 - The various settings implementations share a common logger, instead of each
   implementation class providing its own. This is aimed to reduce noise from
   the logs and to ensure specs validating logging do not need to tie so
   closely to implementation details.

* settings: add password-wrapped setting

* settings: make any setting type capable of being nullable

* settings: add `Settings#names` to power programatic iteration

* cli: route CLI-flag deprecations in to deprecation logger

* settings: group API-related settings under `api.*`

retains deprecated aliases, and is fully backward-compatible.

* webserver: cleanup orphaned attr accessors for never-set ivars

* api: pull settings extraction down from agent

This net-no-change refactor introduces a new method `WebServer#from_settings`
that bridges the gap between Logstash settings and Puma-related options, so
that future additions to the API settings don't add complexity to the Agent.

It also has the benefit of initializing the API Rack App and just ONCE, instead
of once per attempted HTTP port.

* api: add optional TLS/SSL

* docs: reference API security settings

* api: when configured securely, bind to all available interfaces by default

* cleanup: remove unused cert artifacts

* tests: generate fresh webserver certificates

* certs: actually add the binary keystores 🤦
2021-10-19 14:13:20 -07:00
Andres Rodriguez
9f45087d80
Add pipeline.ordered setting for docker image (#13300)
Adds the pipeline.ordered setting to env2yml.go for the docker image.

Closes: #13293
2021-10-07 16:42:29 -04:00
kaisecheng
1913de1bf7
update golang image to 1.17.1(#13260)
update golang image to 1.17.1 to get rid of expired DST Root CA X3
disable download manager test cases to silent Faraday::SSLError

Fixed: #13261

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2021-10-01 18:51:09 +02:00
kaisecheng
8c83282bae
geoip integrate air-gapped bootstrap script (#13104)
This PR integrates Elasticsearch bootstrap script to help users keep Logstah geoip plugin run without online update check.
Add `xpack.geoip.download.endpoint` option to config geoip database service endpoint.
Users can point to `http://localhost:8080/overview.json` when using the script to bootstrap nginx docker
2021-09-27 18:56:22 +02:00
kaisecheng
85abb95d9a
add the missing logstash config supported by env2yaml for docker (#13178)
Fixed: #13138
2021-08-30 17:39:24 +01:00
Rob Bavey
35d07fffa2
Update jinja2 dependency in docker build (#12994) 2021-06-17 09:12:09 -04:00
João Duarte
d1b12ded1d
fix ubi8 docker image creation by skipping yum clean metadata (#12902)
ubi8 image uses microdnf as a package manager, and microdnf does
not support the "yum clean metadata" command. This commit adds
the logic to skip this command if the image_flavor is ubi8
2021-05-12 15:05:48 +01:00
Rob Bavey
d0e79553b5
[Build] On aarch64 docker build, install noarch version of bind-license first (#12891)
On aarch64, yum does not pick the correct 'bind-license' package,
this commit installs a specific noarch RPM

This commit also adds retry to the yum installs and updates.
2021-05-11 22:40:43 -04:00
Rob Bavey
edd9b33f9b
[Build] Fix version script when VERSION_QUALIFIER is empty string (#12728)
Prior to this release a VERSION_QUALIFER env set to an empty string
would create versions looking like `8.0.0--SNAPSHOT` instead of
`8.0.0-SNAPSHOT`, causing the release manager builds to fail.
2021-03-05 09:34:28 -05:00
Rob Bavey
872546ec19
Update dockerfile template to allow selection of architecture by env (#12636)
This commit updates the dockerfile template to support environment
variables being used to retrieve the architecture appropriate logstash
build, in the same way as is currently done for the Elasticsearch docker build.
This is required to support the official dockerhub builds of Logstash.

Relates #12578
2021-02-03 09:25:49 -05:00
kaisecheng
4bc9dad69c
Remove ruby execution engine (#12517)
* remove Logstash::Pipeline
* remove logstash/event, Logstash::SignalEvent
* remove Engine.Ruby on java side
* remove config pipeline.java_execution
Fixed: #11236
2020-12-15 10:41:27 +01:00