-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Autodiscover provider for Nomad #14954
Conversation
Add a test for the basic hint features
Add tests for the emition of events
Add tests for the emition of events
…autodiscovery-nomad
…llocations Add local constants to track the possible status of the allocations
On older nomad versions (0.8.4) the `NodeName` attribute of the allocation is empty. This means that sometimes we cannot assign a proper `host` to the event. As a workaround we use the `NodeID` to get the the name from the actual client node.
This is a workaround for Nomad v0.8 that doesn't provide the NodeName directly in the allocation object. We use the NodeID to fetch it from the API.
Remove debug statement
- WIP emit only one task metadata event. - Rename the matchers/indexers of the add_nomad_metadata processor to match the Nomad lingo.
- Rename `meta.meta` to `meta.tasks` and fix the tests. - Add the main import to the nomad provider in the cmd tool.
WIP patch for the unchanged allocations and avoids triggering new harvesters for those allocations that were previously discovered.
- Rename `uuid` field to `alloc_id`. - Use WatchOptions.RefreshInterval (SyncInterval on the config) for the sync interval of the watcher
jenkins run the tests please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jorgelbg!
@jsoriano I cherry-picked the changes from your branch, but I'm ok if we merge from any side. Thanks for taking care of fixing those issues (especially the Windows test). Changes look great! I was planning on jumping into this after the holidays but glad that you were faster! |
@jorgelbg could you please update the branch with master? Failing tests were fixed yesterday. |
jenkins run the tests please |
Merged, thanks a lot @jorgelbg! |
Initial features to support logs collection from applications deployed in Nomad. Add a new `nomad` autodiscover provider (based on the Kubernetes provider). With this new provider, it is possible to start new harvesters by looking at the jobs allocated on each node. With this, filebeat can be run as a system job on each node and each filebeat instance is responsible for enriching and shipping the local logs. This autodiscover provider supports hints-based autodiscover. Add a new `add_nomad_metadata` processor that matches events to specific allocations and adds the metadata. Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co> (cherry picked from commit 24397d8)
Thank you all for working on this! |
Initial features to support logs collection from applications deployed in Nomad. Add a new `nomad` autodiscover provider (based on the Kubernetes provider). With this new provider, it is possible to start new harvesters by looking at the jobs allocated on each node. With this, filebeat can be run as a system job on each node and each filebeat instance is responsible for enriching and shipping the local logs. This autodiscover provider supports hints-based autodiscover. Add a new `add_nomad_metadata` processor that matches events to specific allocations and adds the metadata. (cherry picked from commit 24397d8) Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co> Co-authored-by: Jorge Luis Betancourt <jorge-luis.betancourt@trivago.com>
At trivago we run an internal cloud using Nomad from Hashicorp. Our logging solution is based on ELK and we use Filebeat to ship the logs from our client nodes into Kafka where it is later on ingested into Elasticsearch using Logstash. Previously we used the and input looking for new jobs in a defined
path
, but the logs lacked a lot of context/metadata from the Job definition/allocation.This PR adds a new discover module (architecture based on the Kubernetes module). With this new provider, it is possible to start new harvesters by looking at the jobs allocated on each node. We currently run filebeat as a system job on each node and each filebeat instance is responsible for enriching and shipping the local logs.
Example of the configuration for the new provider:
By using the autodiscover module it is possible to define custom processors using the
meta
stanza on the Nomad job (similar to how it is defined using labels on Kubernetes). For instance:This example defines a custom
dissect
tokenizer for the logs of this specific task that adds thedissect
field with a content similar to:By default the following fields are added from the Nomad job/allocation:
job
namespace
status
type
(job type: system/service/batch)task.*
(information about the task and custom metadata defined in the job/group/task using themeta
stanza)datacenters
region
The PR also includes an
add_nomad_metadata
processor that matches events to specific allocations and adds the metadata.We've been running this in our production clusters for a few weeks now.
TODO:
How to test locally
nomad agent -dev
).