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

Update beats framework to 675f2b0 + ECS #1582

Merged
merged 5 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------
Dependency: github.com/elastic/beats
Version: master
Revision: 122fb9364c9fc9d1d6508a864e132396180f9c38
Revision: 675f2b000b067ad9fb2ee2fbe2bb3d98ecfab30c
License type (autodetected): Apache-2.0
./vendor/github.com/elastic/beats/LICENSE.txt:
--------------------------------------------------------------------
Expand Down Expand Up @@ -2378,7 +2378,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------
Dependency: golang.org/x/tools
Version: release-branch.go1.10
Version: release-branch.go1.11
Revision: release-branch.go1.10
License type (autodetected): BSD-3-Clause
./vendor/golang.org/x/tools/LICENSE:
Expand Down
2 changes: 1 addition & 1 deletion _beats/.go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.3
1.11.2
13 changes: 9 additions & 4 deletions _beats/dev-tools/cmd/dashboards/export_dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func Export(client *http.Client, conn string, spaceID string, dashboard string,
for _, obj := range objects {
o := obj.(common.MapStr)

// All fields are optional, so errors are not catched
decodeValue(o, "attributes.uiStateJSON")
decodeValue(o, "attributes.visState")
decodeValue(o, "attributes.optionsJSON")
Expand All @@ -104,23 +105,27 @@ func Export(client *http.Client, conn string, spaceID string, dashboard string,
return err
}

err = ioutil.WriteFile(out, []byte(data.StringToPrint()), 0666)
err = ioutil.WriteFile(out, []byte(data.StringToPrint()), 0644)
if !quiet {
log.Printf("The dashboard %s was exported under the %s file\n", dashboard, out)
}
return err
}

func decodeValue(data common.MapStr, key string) {
func decodeValue(data common.MapStr, key string) error {
v, err := data.GetValue(key)
if err != nil {
return
return err
}
s := v.(string)
var d interface{}
json.Unmarshal([]byte(s), &d)
err = json.Unmarshal([]byte(s), &d)
if err != nil {
return fmt.Errorf("error decoding %s: %v", key, err)
}

data.Put(key, d)
return nil
}

func ReadManifest(file string) ([]map[string]string, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var usageText = `
Usage: kibana_index_pattern [flags]
kibana_index_pattern generates Kibana index patterns from the Beat's
fields.yml file. It will create a index pattern file that is usable with both
Kibana 5.x and 6.x.
Kibana 6.x and 7.x.
Options:
`[1:]

Expand Down Expand Up @@ -67,11 +67,12 @@ func main() {
log.Fatal("Index pattern must be set (-index).")
}

version5, _ := common.NewVersion("5.0.0")
version6, _ := common.NewVersion("6.0.0")
versions := []common.Version{*version5, *version6}
versions := []string{
"6.0.0",
}
for _, version := range versions {
indexPattern, err := kibana.NewGenerator(indexPattern, beatName, fieldsYAMLFile, outputDir, beatVersion, version)
version, _ := common.NewVersion(version)
indexPattern, err := kibana.NewGenerator(indexPattern, beatName, fieldsYAMLFile, outputDir, beatVersion, *version)
if err != nil {
log.Fatal(err)
}
Expand Down
162 changes: 162 additions & 0 deletions _beats/dev-tools/ecs-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,170 @@
alias: true
copy_to: false

- from: system.syslog.hostname
to: host.hostname
alias: true
copy_to: false

- from: system.syslog.program
to: process.name
alias: true
copy_to: false

- from: system.syslog.pid
to: process.pid
alias: true
copy_to: false

- from: system.syslog.message
to: message
alias: true
copy_to: false

# From Auditbeat's auditd module.
- from: source.hostname
to: source.domain
alias: true
copy_to: false

- from: iis.access.server_ip
to: destination.ip
alias: true
copy_to: false

- from: iis.access.remote_ip
to: source.ip
alias: true
copy_to: false

- from: iis.access.url
to: url.path
alias: true
copy_to: false

- from: iis.access.query_string
to: url.query
alias: true
copy_to: false

- from: iis.access.port
to: destination.port
alias: true
copy_to: false

- from: iis.access.user_name
to: user.name
alias: true
copy_to: false

- from: iis.access.hostname
to: destination.domain
alias: true
copy_to: false

- from: iis.access.user_agent.original
to: user_agent.original
alias: true
copy_to: false

- from: iis.access.geoip.continent_name
to: source.geo.continent_name
alias: true
copy_to: false

- from: iis.access.geoip.country_iso_code
to: source.geo.country_iso_code
alias: true
copy_to: false

- from: iis.access.geoip.location
to: source.geo.location
alias: true
copy_to: false

- from: iis.access.geoip.region_name
to: source.geo.region_name
alias: true
copy_to: false

- from: iis.access.geoip.city_name
to: source.geo.city_name
alias: true
copy_to: false

- from: iis.access.geoip.region_iso_code
to: source.geo.region_iso_code
alias: true
copy_to: false

# Note: `http` is not officially in ECS yet

- from: iis.access.method
to: http.request.method
alias: true
copy_to: false

- from: iis.access.response_code
to: http.response.status_code
alias: true
copy_to: false

- from: iis.access.referrer
to: http.request.referrer
alias: true
copy_to: false

- from: haproxy.client.port
to: source.port
alias: true
copy_to: false

- from: haproxy.process_name
to: process.name
alias: true
copy_to: false

- from: haproxy.pid
to: process.pid
alias: true
copy_to: false

- from: haproxy.destination.ip
to: destination.ip
alias: true
copy_to: false

- from: haproxy.destination.port
to: destination.port
alias: true
copy_to: false

- from: haproxy.geoip.continent_name
to: source.geo.continent_name
alias: true
copy_to: false

- from: haproxy.geoip.country_iso_code
to: source.geo.country_iso_code
alias: true
copy_to: false

- from: haproxy.geoip.location
to: source.geo.location
alias: true
copy_to: false

- from: haproxy.geoip.region_name
to: source.geo.region_name
alias: true
copy_to: false

- from: haproxy.geoip.city_name
to: source.geo.city_name
alias: true
copy_to: false

- from: haproxy.geoip.region_iso_code
to: source.geo.region_iso_code
alias: true
copy_to: false
1 change: 0 additions & 1 deletion _beats/dev-tools/jenkins_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ trap cleanup EXIT

# This controls the defaults used the Jenkins package job. They can be
# overridden by setting them in the environement prior to running this script.
export BEAT_VERSION_QUALIFIER="${VERSION_QUALIFIER:-}"
export SNAPSHOT="${SNAPSHOT:-true}"
export PLATFORMS="${PLATFORMS:-+linux/armv7 +linux/ppc64le +linux/s390x +linux/mips64}"

Expand Down
11 changes: 11 additions & 0 deletions _beats/dev-tools/make/mage.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
MAGE_PRESENT := $(shell command -v mage 2> /dev/null)
MAGE_IMPORT_PATH?=github.com/elastic/beats/vendor/github.com/magefile/mage
export MAGE_IMPORT_PATH

.PHONY: mage
mage:
ifndef MAGE_PRESENT
go install ${MAGE_IMPORT_PATH}
@-mage -clean 2> /dev/null
endif
@true
38 changes: 38 additions & 0 deletions _beats/dev-tools/make/xpack.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This Makefile is for x-pack Beats. Its only responsibility is to provide
# compatibility with existing Jenkins and Travis setups.

#
# Variables
#
PWD := $(CURDIR)
.DEFAULT_GOAL := help

#
# Includes
#
include $(ES_BEATS)/dev-tools/make/mage.mk

#
# Targets
#
.PHONY: clean
clean: mage
mage clean

.PHONY: fmt
fmt: mage
mage fmt

.PHONY: check
check: mage
mage check

.PHONY: testsuite
testsuite: mage
mage update build unitTest integTest

# Default target.
.PHONY: help
help:
@echo Use mage rather than make. Here are the available mage targets:
@mage -l
13 changes: 10 additions & 3 deletions _beats/dev-tools/packaging/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ func TestDeb(t *testing.T) {
}

func TestTar(t *testing.T) {
tars := getFiles(t, regexp.MustCompile(`\.tar\.gz$`))
// Regexp matches *-arch.tar.gz, but not *-arch.docker.tar.gz
tars := getFiles(t, regexp.MustCompile(`-\w+\.tar\.gz$`))
for _, tar := range tars {
checkTar(t, tar)
}
Expand All @@ -94,7 +95,7 @@ func TestZip(t *testing.T) {
}

func TestDocker(t *testing.T) {
dockers := getFiles(t, regexp.MustCompile(`\.docker.tar$`))
dockers := getFiles(t, regexp.MustCompile(`\.docker\.tar\.gz$`))
for _, docker := range dockers {
checkDocker(t, docker)
}
Expand Down Expand Up @@ -514,7 +515,13 @@ func readDocker(dockerFile string) (*packageFile, *dockerInfo, error) {
var info *dockerInfo
layers := make(map[string]*packageFile)

tarReader := tar.NewReader(file)
gzipReader, err := gzip.NewReader(file)
if err != nil {
return nil, nil, err
}
defer gzipReader.Close()

tarReader := tar.NewReader(gzipReader)
for {
header, err := tarReader.Next()
if err != nil {
Expand Down
Loading