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

Cherry-pick #18000 to 7.x: Set agent.name to hostname by default #18155

Merged
merged 2 commits into from
May 4, 2020

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented May 2, 2020

Cherry-pick of PR #18000 to 7.x branch. Original message:

What does this PR do?

Since ECS does not define agent.hostname it will be removed in a future release.
In order to always have a field available to identify the agent by name we will
set the agent.name to hostname unless the user has provided a custom name.

Why is it important?

This puts the hostname into events by default. This will be important for cases where events may not contain the forwarding machine's hostname. For example when forwarding syslog data we may not have the host or observer namespaces populated.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

Relates #16377

Logs

Event output when name is unset.

  "agent": {
    "name": "mac.example.com",
    "type": "filebeat",
    "version": "8.0.0",
    "hostname": "mac.example.com",
    "ephemeral_id": "a690e034-28ac-413b-8bad-b618b57a2d79",
    "id": "fb930b06-9125-40b5-902c-bf0b0f077592"
  },

Event when name: my_custom_name is set:

  "agent": {
    "type": "filebeat",
    "version": "8.0.0",
    "hostname": "mac.example.com",
    "ephemeral_id": "c421fd5a-613b-4c40-aaa3-128c7e84a47c",
    "id": "b7e68e5b-cc5b-43b3-9e6b-0e74d2abde4d",
    "name": "my_custom_name"
  }

@andrewkroh andrewkroh requested a review from a team as a code owner May 2, 2020 13:05
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 2, 2020
Since ECS does not define agent.hostname it will be removed in a future release.
In order to always have a field available to identify the agent by name we will
set the agent.name to hostname unless the user has provided a custom name.

Relates elastic#16377

(cherry picked from commit 3711ee6)
@elasticmachine
Copy link
Collaborator

💔 Build Failed

Pipeline View Test View Changes Artifacts preview stats

Expand to view the summary

Build stats

Test stats 🧪

Test Results
Failed 0
Passed 5666
Skipped 854
Total 6520

Steps errors

Expand to view the steps failures

  • Name: Make -C generator/_templates/metricbeat test
    • Description: make -C generator/_templates/metricbeat test

    • Result: FAILURE

    • Duration: 1 min 52 sec<

    • Start Time: 2020-05-02T13:49:47.740+0000

Log output

Expand to view the last 100 lines of log output

[2020-05-02T14:36:32.687Z] 
[2020-05-02T14:36:32.687Z] OK
[2020-05-02T14:36:32.687Z] >> python test: Integration Testing Complete
[2020-05-02T14:36:36.090Z] Recording test results
[2020-05-02T14:36:42.702Z] Stashed 16 file(s)
[2020-05-02T14:36:42.717Z] Archiving artifacts
[2020-05-02T14:36:43.766Z] + curl -sSLo codecov https://codecov.io/bash
[2020-05-02T14:36:44.358Z] + FILE=auditbeat/build/coverage/full.cov
[2020-05-02T14:36:44.358Z] + [ -f auditbeat/build/coverage/full.cov ]
[2020-05-02T14:36:44.358Z] + FILE=filebeat/build/coverage/full.cov
[2020-05-02T14:36:44.358Z] + [ -f filebeat/build/coverage/full.cov ]
[2020-05-02T14:36:44.358Z] + FILE=heartbeat/build/coverage/full.cov
[2020-05-02T14:36:44.358Z] + [ -f heartbeat/build/coverage/full.cov ]
[2020-05-02T14:36:44.358Z] + FILE=libbeat/build/coverage/full.cov
[2020-05-02T14:36:44.358Z] + [ -f libbeat/build/coverage/full.cov ]
[2020-05-02T14:36:44.358Z] + FILE=metricbeat/build/coverage/full.cov
[2020-05-02T14:36:44.358Z] + [ -f metricbeat/build/coverage/full.cov ]
[2020-05-02T14:36:44.358Z] + FILE=packetbeat/build/coverage/full.cov
[2020-05-02T14:36:44.358Z] + [ -f packetbeat/build/coverage/full.cov ]
[2020-05-02T14:36:44.358Z] + FILE=winlogbeat/build/coverage/full.cov
[2020-05-02T14:36:44.358Z] + [ -f winlogbeat/build/coverage/full.cov ]
[2020-05-02T14:36:44.358Z] + FILE=journalbeat/build/coverage/full.cov
[2020-05-02T14:36:44.358Z] + [ -f journalbeat/build/coverage/full.cov ]
[2020-05-02T14:36:45.748Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats
[2020-05-02T14:36:46.056Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-05-02T14:36:46.070Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Lint
[2020-05-02T14:36:46.125Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Winlogbeat-oss
[2020-05-02T14:36:46.180Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-05-02T14:36:46.234Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Elastic-Agent-x-pack
[2020-05-02T14:36:46.297Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Journalbeat-oss
[2020-05-02T14:36:46.363Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Dockerlogbeat
[2020-05-02T14:36:46.426Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Functionbeat-x-pack
[2020-05-02T14:36:46.485Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Elastic-Agent-x-pack-Windows
[2020-05-02T14:36:46.541Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-05-02T14:36:46.699Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-05-02T14:36:46.766Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-05-02T14:36:46.823Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Heartbeat-oss
[2020-05-02T14:36:46.885Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Libbeat-x-pack
[2020-05-02T14:36:46.944Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Winlogbeat-Windows-x-pack
[2020-05-02T14:36:46.999Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Auditbeat-Linux
[2020-05-02T14:36:47.056Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Filebeat-Windows
[2020-05-02T14:36:47.111Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Metricbeat-Windows
[2020-05-02T14:36:47.173Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Packetbeat-oss
[2020-05-02T14:36:47.228Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-05-02T14:36:47.284Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Winlogbeat-Windows
[2020-05-02T14:36:47.343Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Filebeat-x-pack
[2020-05-02T14:36:47.398Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Functionbeat-Windows
[2020-05-02T14:36:47.453Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Heartbeat-Windows
[2020-05-02T14:36:47.514Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Filebeat-oss
[2020-05-02T14:36:47.571Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Auditbeat-Windows
[2020-05-02T14:36:47.625Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Libbeat-oss
[2020-05-02T14:36:47.690Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Metricbeat-Python-integration-tests
[2020-05-02T14:36:47.753Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Libbeat-crosscompile
[2020-05-02T14:36:47.807Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests
[2020-05-02T14:36:47.874Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Libbeat-stress-tests
[2020-05-02T14:36:47.940Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-05-02T14:36:48.281Z] + cat
[2020-05-02T14:36:48.281Z] + /usr/local/bin/runbld ./runbld-script
[2020-05-02T14:36:48.281Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-05-02T14:36:54.891Z] runbld>>> runbld started
[2020-05-02T14:36:54.891Z] runbld>>> 1.6.11/a66728ff8f4356963772e6e6d2069392fa06acbe
[2020-05-02T14:36:56.807Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-18155' in order of occurrence in the config (last value wins).
[2020-05-02T14:36:57.750Z] runbld>>> Debug logging enabled.
[2020-05-02T14:36:57.750Z] runbld>>> Storing result
[2020-05-02T14:36:58.011Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-05-02T14:36:58.011Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200502143657-3D7EA4CB
[2020-05-02T14:36:58.011Z] runbld>>> Adding system facts.
[2020-05-02T14:36:58.963Z] runbld>>> Adding vcs info for the latest commit:  d341018c9b857f0c1b325a717d5014c244aa22bb
[2020-05-02T14:36:59.230Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-05-02T14:36:59.230Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-05-02T14:36:59.491Z] + echo 'Processing JUnit reports with runbld...'
[2020-05-02T14:36:59.491Z] Processing JUnit reports with runbld...
[2020-05-02T14:36:59.754Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-05-02T14:36:59.754Z] runbld>>> DURATION: 21ms
[2020-05-02T14:36:59.754Z] runbld>>> STDOUT: 40 bytes
[2020-05-02T14:36:59.754Z] runbld>>> STDERR: 49 bytes
[2020-05-02T14:36:59.754Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-05-02T14:36:59.754Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats
[2020-05-02T14:37:01.142Z] runbld>>> Storing build metadata: 
[2020-05-02T14:37:01.142Z] runbld>>> Adding test report.
[2020-05-02T14:37:01.142Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats
[2020-05-02T14:37:02.085Z] runbld>>> Found 78 test output files
[2020-05-02T14:37:02.658Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-05-02T14:37:02.658Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-05-02T14:37:02.658Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-05-02T14:37:03.603Z] runbld>>> Test output logs contained: Errors: 0 Failures: 0 Tests: 6370 Skipped: 701
[2020-05-02T14:37:03.865Z] runbld>>> Storing result
[2020-05-02T14:37:03.865Z] runbld>>> FAILURES: 0
[2020-05-02T14:37:04.126Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-05-02T14:37:04.126Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200502143657-3D7EA4CB
[2020-05-02T14:37:04.126Z] runbld>>> Email notification disabled by environment variable.
[2020-05-02T14:37:04.126Z] runbld>>> Slack notification disabled by environment variable.
[2020-05-02T14:37:09.616Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18155
[2020-05-02T14:37:09.700Z] [INFO] getVaultSecret: Getting secrets
[2020-05-02T14:37:09.753Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-05-02T14:37:10.372Z] + chmod 755 generate-build-data.sh
[2020-05-02T14:37:10.373Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18155/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18155/runs/2 FAILURE 5286383
[2020-05-02T14:37:10.923Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18155/runs/2/steps/?limit=10000 -o steps-info.json
[2020-05-02T14:37:11.174Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18155/runs/2/tests/?status=FAILED -o tests-errors.json
[2020-05-02T14:37:11.725Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18155/runs/2/log/ -o pipeline-log.txt

@elasticmachine
Copy link
Collaborator

Pinging @elastic/siem (Team:SIEM)

@andrewkroh andrewkroh removed the needs_team Indicates that the issue/PR needs a Team:* label label May 4, 2020
@andrewkroh andrewkroh requested a review from exekias May 4, 2020 14:13
@andrewkroh andrewkroh merged commit e1ce07e into elastic:7.x May 4, 2020
@andrewkroh andrewkroh deleted the backport_18000_7.x branch January 14, 2022 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants