Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/beats
Browse files Browse the repository at this point in the history
  • Loading branch information
narph committed Oct 29, 2020
2 parents 70f5f0e + 713a503 commit 81e66b5
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix invalid IP addresses in DNS query results from Sysmon data. {issue}18432[18432] {pull}18436[18436]
- Fields from Winlogbeat modules were not being included in index templates and patterns. {pull}18983[18983]
- Add source.ip validation for event ID 4778 in the Security module. {issue}19627[19627]
- Protect against accessing undefined variables in Sysmon module. {issue}22219[22219] {pull}22236[22236]

*Functionbeat*

Expand Down
29 changes: 19 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ def withBeatsEnv(Map args = [:], Closure body) {
git config --global user.name "beatsmachine"
fi''')
}
// Skip to upload the generated files by default.
def upload = false
try {
// Add more stability when dependencies are not accessible temporarily
// See https://github.com/elastic/beats/issues/21609
Expand All @@ -339,9 +341,12 @@ def withBeatsEnv(Map args = [:], Closure body) {
cmd(label: 'Download modules to local cache - retry', script: 'go mod download', returnStatus: true)
}
body()
} catch(err) {
// Upload the generated files ONLY if the step failed. This will avoid any overhead with Google Storage
upload = true
} finally {
if (archive) {
archiveTestOutput(testResults: testResults, artifacts: artifacts, id: args.id)
archiveTestOutput(testResults: testResults, artifacts: artifacts, id: args.id, upload: upload)
}
// Tear down the setup for the permamnent workers.
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
Expand Down Expand Up @@ -419,16 +424,20 @@ def archiveTestOutput(Map args = [:]) {
script: 'rm -rf ve || true; find . -type d -name vendor -exec rm -r {} \\;')
} else { log(level: 'INFO', text: 'Delete folders that are causing exceptions (See JENKINS-58421) is disabled for Windows.') }
junitAndStore(allowEmptyResults: true, keepLongStdio: true, testResults: args.testResults, stashedTestReports: stashedTestReports, id: args.id)
tarAndUploadArtifacts(file: "test-build-artifacts-${args.id}.tgz", location: '.')
if (args.upload) {
tarAndUploadArtifacts(file: "test-build-artifacts-${args.id}.tgz", location: '.')
}
}
catchError(buildResult: 'SUCCESS', message: 'Failed to archive the build test results', stageResult: 'SUCCESS') {
def folder = cmd(label: 'Find system-tests', returnStdout: true, script: 'python .ci/scripts/search_system_tests.py').trim()
log(level: 'INFO', text: "system-tests='${folder}'. If no empty then let's create a tarball")
if (folder.trim()) {
// TODO: nodeOS() should support ARM
def os_suffix = isArm() ? 'linux' : nodeOS()
def name = folder.replaceAll('/', '-').replaceAll('\\\\', '-').replaceAll('build', '').replaceAll('^-', '') + '-' + os_suffix
tarAndUploadArtifacts(file: "${name}.tgz", location: folder)
if (args.upload) {
catchError(buildResult: 'SUCCESS', message: 'Failed to archive the build test results', stageResult: 'SUCCESS') {
def folder = cmd(label: 'Find system-tests', returnStdout: true, script: 'python .ci/scripts/search_system_tests.py').trim()
log(level: 'INFO', text: "system-tests='${folder}'. If no empty then let's create a tarball")
if (folder.trim()) {
// TODO: nodeOS() should support ARM
def os_suffix = isArm() ? 'linux' : nodeOS()
def name = folder.replaceAll('/', '-').replaceAll('\\\\', '-').replaceAll('build', '').replaceAll('^-', '') + '-' + os_suffix
tarAndUploadArtifacts(file: "${name}.tgz", location: folder)
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions auditbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2019"
#- "windows-2008-r2" https://github.com/elastic/beats/issues/19799
windows-2016:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
1 change: 1 addition & 0 deletions filebeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2019"
#- "windows-2008-r2" https://github.com/elastic/beats/issues/19795
windows-2016:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
11 changes: 11 additions & 0 deletions heartbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,14 @@ stages:
- "windows-10"
branches: true ## for all the branches
tags: true ## for all the tags
windows-2008:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2008-r2"
when: ## Override the top-level when.
comments:
- "/test heartbeat for windows-2008"
labels:
- "windows-2008"
branches: true ## for all the branches
tags: true ## for all the tag
1 change: 1 addition & 0 deletions metricbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2019"
#- "windows-2008-r2" https://github.com/elastic/beats/issues/19800
windows-2016:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
11 changes: 11 additions & 0 deletions packetbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,14 @@ stages:
- "windows-10"
branches: true ## for all the branches
tags: true ## for all the tags
windows-2008:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2008-r2"
when: ## Override the top-level when.
comments:
- "/test packetbeat for windows-2008"
labels:
- "windows-2008"
branches: true ## for all the branches
tags: true ## for all the tags
1 change: 1 addition & 0 deletions winlogbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2019"
#- "windows-2008-r2" https://github.com/elastic/beats/issues/19798
windows-2016:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
Expand Down
11 changes: 11 additions & 0 deletions x-pack/auditbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,14 @@ stages:
- "windows-10"
branches: true ## for all the branches
tags: true ## for all the tags
windows-2008:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2008-r2"
when: ## Override the top-level when.
comments:
- "/test auditbeat for windows-2008"
labels:
- "windows-2008"
branches: true ## for all the branches
tags: true ## for all the tags
11 changes: 11 additions & 0 deletions x-pack/elastic-agent/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,14 @@ stages:
- "windows-10"
branches: true ## for all the branches
tags: true ## for all the tags
windows-2008:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2008-r2"
when: ## Override the top-level when.
comments:
- "/test x-pack/elastic-agent for windows-2008"
labels:
- "windows-2008"
branches: true ## for all the branches
tags: true ## for all the tags
11 changes: 11 additions & 0 deletions x-pack/filebeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,14 @@ stages:
- "windows-10"
branches: true ## for all the branches
tags: true ## for all the tags
windows-2008:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2008-r2"
when: ## Override the top-level when.
comments:
- "/test x-pack/filebeat for windows-2008"
labels:
- "windows-2008"
branches: true ## for all the branches
tags: true ## for all the tags
11 changes: 11 additions & 0 deletions x-pack/functionbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,14 @@ stages:
- "windows-10"
branches: true ## for all the branches
tags: true ## for all the tags
windows-2008:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2008-r2"
when: ## Override the top-level when.
comments:
- "/test x-pack/functionbeat for windows-2008"
labels:
- "windows-2008"
branches: true ## for all the branches
tags: true ## for all the tags
11 changes: 11 additions & 0 deletions x-pack/metricbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,14 @@ stages:
- "windows-10"
branches: true ## for all the branches
tags: true ## for all the tags
windows-2008:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2008-r2"
when: ## Override the top-level when.
comments:
- "/test x-pack/metricbeat for windows-2008"
labels:
- "windows-2008"
branches: true ## for all the branches
tags: true ## for all the tags
11 changes: 11 additions & 0 deletions x-pack/packetbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,14 @@ stages:
- "windows-10"
branches: true ## for all the branches
tags: true ## for all the tags
windows-2008:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2008-r2"
when: ## Override the top-level when.
comments:
- "/test x-pack/winlogbeat for windows-2008"
labels:
- "windows-2008"
branches: true ## for all the branches
tags: true ## for all the tags
11 changes: 11 additions & 0 deletions x-pack/winlogbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,14 @@ stages:
- "windows-10"
branches: true ## for all the branches
tags: true ## for all the tags
windows-2008:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-2008-r2"
when: ## Override the top-level when.
comments:
- "/test x-pack/winlogbeat for windows-2008"
labels:
- "windows-2008"
branches: true ## for all the branches
tags: true ## for all the tags
12 changes: 11 additions & 1 deletion x-pack/winlogbeat/module/sysmon/config/winlogbeat-sysmon.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ var sysmon = (function () {
return;
}
var exe = evt.Get(pathField);
if (!exe) {
return;
}
evt.Put(nameField, path.basename(exe));
};

Expand All @@ -327,7 +330,11 @@ var sysmon = (function () {
};

var addUser = function (evt) {
var userParts = evt.Get("winlog.event_data.User").split("\\");
var userParts = evt.Get("winlog.event_data.User");
if (!userParts) {
return;
}
userParts = userParts.split("\\");
if (userParts.length === 2) {
evt.Delete("user");
evt.Put("user.domain", userParts[0]);
Expand Down Expand Up @@ -406,6 +413,9 @@ var sysmon = (function () {
// in the specified namespace. It also adds all the hashes to 'related.hash'.
var addHashes = function (evt, namespace, hashField) {
var hashes = evt.Get(hashField);
if (!hashes) {
return;
}
evt.Delete(hashField);
hashes.split(",").forEach(function (hash) {
var parts = hash.split("=");
Expand Down

0 comments on commit 81e66b5

Please sign in to comment.