Skip to content

Commit

Permalink
Cherry-pick #8485 to 6.x: Beatless initial PR (#8736)
Browse files Browse the repository at this point in the history
Cherry-pick of PR #8485 to 6.x branch. Original message: 

## This PR provide the following

1. Plugin infra for developing providers and functions
2. A local stdin provider only used for testing, I will remove it in the
final version.
3. AWS provider and function types for:
  - Cloudwatch logs
  - SQS
  - Kinesis
  - Api web gateway proxy
4. License checker
5. Packaging of artifact
6. Runners
7. CLI infrastructure
8. CLI to push a cloudwatch logs function.
9. CLI to delete any function
10. Processors support.
11. Types to validate value from the users and the lambda function.

## What it doesn't provides

- ECS and full event extraction. (NOT for v1)
- Specifying the AWS credentials in the configuration
- CLI for SQS, Kinesis, API
- Robust CLI interaction with the API, rollback on failure / versioning.
- Removal of not supported outputs
- Removal of seccomp check
- Integration tests
- Updated build task to produce containing the user executable beat and
the linux beats.
- Concurrency / memory settings

## Vendored

- aws/aws-lambda-go
- aws/aws-sdk-go-v2

---

**Note:** The PR look much bigger because of the vendored files.

**Notes 2:** 

Make sure you add this to your config YAMl, I wan't to make the following the default options but it would have been really messy to do it in this PR.

```
# Disable anything that could be send to disk
path.data: /tmp
path.logs: /tmp/logs
logging.to_stderr: true
logging.to_files: false
#logging.level: debug
setup.template.enabled: true
queue.mem:
  events: 50
  flush.min_events: 1
  flush.timeout: 0.5s
```

## related work
- #8449
- #8443
  • Loading branch information
ph authored Oct 24, 2018
1 parent fa70b90 commit 82ef722
Show file tree
Hide file tree
Showing 1,322 changed files with 166,510 additions and 53 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ jobs:
go: $GO_VERSION
stage: test

# Functionbeat
- os: linux
env: TARGETS="-C x-pack/functionbeat testsuite"
go: $GO_VERSION
stage: test

- os: osx
env: TARGETS="TEST_ENVIRONMENT=0 -C x-pack/functionbeat testsuite"
go: $GO_VERSION
stage: test

# Generators
- os: linux
env: TARGETS="-C generator/metricbeat test"
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ https://github.com/elastic/beats/compare/v6.4.0...6.x[Check the HEAD diff]

*Winlogbeat*

*Functionbeat*

==== Bugfixes

*Affecting all Beats*
Expand Down Expand Up @@ -95,6 +97,7 @@ https://github.com/elastic/beats/compare/v6.4.0...6.x[Check the HEAD diff]

*Winlogbeat*

*Functionbeat*

==== Added

Expand Down Expand Up @@ -167,6 +170,10 @@ https://github.com/elastic/beats/compare/v6.4.0...6.x[Check the HEAD diff]

- Add automatic config file reloading. {pull}8023[8023]

*Functionbeat*

- Initial version of Functionbeat. {pull}8678[8678]

==== Deprecated

*Affecting all Beats*
Expand All @@ -188,6 +195,8 @@ https://github.com/elastic/beats/compare/v6.4.0...6.x[Check the HEAD diff]

*Winlogbeat*

*Functionbeat*

==== Known Issue


Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BUILD_DIR=$(CURDIR)/build
COVERAGE_DIR=$(BUILD_DIR)/coverage
BEATS?=auditbeat filebeat heartbeat journalbeat metricbeat packetbeat winlogbeat
BEATS?=auditbeat filebeat heartbeat journalbeat metricbeat packetbeat winlogbeat x-pack/functionbeat
PROJECTS=libbeat $(BEATS)
PROJECTS_ENV=libbeat filebeat metricbeat
PYTHON_ENV?=$(BUILD_DIR)/python-env
Expand All @@ -11,6 +11,7 @@ GOLINT_REPO=github.com/golang/lint/golint
REVIEWDOG=reviewdog
REVIEWDOG_OPTIONS?=-diff "git diff master"
REVIEWDOG_REPO=github.com/haya14busa/reviewdog/cmd/reviewdog
XPACK_SUFFIX=x-pack/

# Runs complete testsuites (unit, system, integration) for all beats with coverage and race detection.
# Also it builds the docs and the generators
Expand Down Expand Up @@ -152,7 +153,7 @@ release: beats-dashboards
@$(foreach var,$(BEATS),$(MAKE) -C $(var) release || exit 1;)
@$(foreach var,$(BEATS), \
test -d $(var)/build/distributions && test -n "$$(ls $(var)/build/distributions)" || exit 0; \
mkdir -p build/distributions/$(var) && mv -f $(var)/build/distributions/* build/distributions/$(var)/ || exit 1;)
mkdir -p build/distributions/$(subst $(XPACK_SUFFIX),'',$(var)) && mv -f $(var)/build/distributions/* build/distributions/$(subst $(XPACK_SUFFIX),'',$(var))/ || exit 1;)

# Builds a snapshot release. The Go version defined in .go-version will be
# installed and used for the build.
Expand Down
219 changes: 219 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,66 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

--------------------------------------------------------------------
Dependency: github.com/aws/aws-lambda-go
Version: =v1.6.0
Revision: 2d482ef09017ae953b1e8d5a6ddac5b696663a3c
License type (autodetected): Apache-2.0
./vendor/github.com/aws/aws-lambda-go/LICENSE:
--------------------------------------------------------------------
Apache License 2.0


--------------------------------------------------------------------
Dependency: github.com/aws/aws-lambda-go
Version: =v1.6.0
Revision: 2d482ef09017ae953b1e8d5a6ddac5b696663a3c
License type (autodetected): MIT
./vendor/github.com/aws/aws-lambda-go/LICENSE-LAMBDACODE:
--------------------------------------------------------------------
MIT No Attribution

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


--------------------------------------------------------------------
Dependency: github.com/aws/aws-sdk-go-v2
Version: v2.0.0-preview.5
Revision: d52522b5f4b95591ff6528d7c54923951aadf099
License type (autodetected): Apache-2.0
./vendor/github.com/aws/aws-sdk-go-v2/LICENSE.txt:
--------------------------------------------------------------------
Apache License 2.0

-------NOTICE.txt-----
AWS SDK for Go
Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2014-2015 Stripe, Inc.

--------------------------------------------------------------------
Dependency: github.com/awslabs/goformation
Version: 1.2.2
Revision: d42502ef32a8892bf380256e2f57c6f69190d802
License type (autodetected): Apache-2.0
./vendor/github.com/awslabs/goformation/LICENSE:
--------------------------------------------------------------------
Apache License 2.0

-------NOTICE-----
GoFormation
Copyright 2011-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.

--------------------------------------------------------------------
Dependency: github.com/bsm/sarama-cluster
Revision: 7e67d87a6b3f83fe08c096fd084691bd9dca112f
Expand Down Expand Up @@ -723,6 +783,14 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------
Dependency: github.com/go-ini/ini
License type (autodetected): Apache-2.0
./vendor/github.com/go-ini/ini/LICENSE:
--------------------------------------------------------------------
Apache License 2.0


--------------------------------------------------------------------
Dependency: github.com/go-ole/go-ole
Revision: de8695c8edbf8236f30d6e1376e20b198a028d42
Expand Down Expand Up @@ -1377,6 +1445,41 @@ License type (autodetected): Apache-2.0
Apache License 2.0


--------------------------------------------------------------------
Dependency: github.com/imdario/mergo
Revision: 9f23e2d6bd2a77f959b2bf6acdbefd708a83a4a4
License type (autodetected): BSD-3-Clause
./vendor/github.com/imdario/mergo/LICENSE:
--------------------------------------------------------------------
Copyright (c) 2013 Dario Castañé. All rights reserved.
Copyright (c) 2012 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------
Dependency: github.com/inconshreveable/mousetrap
Revision: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
Expand Down Expand Up @@ -1422,6 +1525,16 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------
Dependency: github.com/jmespath/go-jmespath
Version: 0.2.2
Revision: 3433f3ea46d9f8019119e7dd41274e112a2359a9
License type (autodetected): Apache-2.0
./vendor/github.com/jmespath/go-jmespath/LICENSE:
--------------------------------------------------------------------
Apache License 2.0


--------------------------------------------------------------------
Dependency: github.com/joeshaw/multierror
Revision: 69b34d4ec901851247ae7e77d33909caf9df99ed
Expand Down Expand Up @@ -2138,6 +2251,112 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------
Dependency: github.com/sanathkr/go-yaml
Version: v2
Revision: ed9d249f429b3f5a69f80a7abef6bfce81fef894
License type (autodetected): Apache-2.0
./vendor/github.com/sanathkr/go-yaml/LICENSE:
--------------------------------------------------------------------
Apache License 2.0


--------------------------------------------------------------------
Dependency: github.com/sanathkr/go-yaml
Version: v2
Revision: ed9d249f429b3f5a69f80a7abef6bfce81fef894
License type (autodetected): MIT
./vendor/github.com/sanathkr/go-yaml/LICENSE.libyaml:
--------------------------------------------------------------------
The following files were ported to Go from C files of libyaml, and thus
are still covered by their original copyright and license:

apic.go
emitterc.go
parserc.go
readerc.go
scannerc.go
writerc.go
yamlh.go
yamlprivateh.go

Copyright (c) 2006 Kirill Simonov

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------
Dependency: github.com/sanathkr/yaml
Revision: 0056894fa522748ca336761ffeeeb6bbae654d07
License type (autodetected): MIT
./vendor/github.com/sanathkr/yaml/LICENSE:
--------------------------------------------------------------------
The MIT License (MIT)

Copyright (c) 2014 Sam Ghods

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


Copyright (c) 2012 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------
Dependency: github.com/shirou/gopsutil
Version: v2.18.06
Expand Down
3 changes: 3 additions & 0 deletions dev-tools/generate_notice.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import json
import csv
import re
import pdb
import copy


Expand Down Expand Up @@ -87,6 +88,8 @@ def gather_dependencies(vendor_dirs, overrides=None):

# Allow to skip files that could match the `LICENSE` pattern but does not have any license information.
SKIP_FILES = [
# AWS lambda go defines that some part of the code is APLv2 and other on a MIT Modified license.
"./vendor/github.com/aws/aws-lambda-go/LICENSE-SUMMARY"
]


Expand Down
7 changes: 6 additions & 1 deletion dev-tools/mage/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package mage

import (
"os"
"path/filepath"

"github.com/magefile/mage/sh"
Expand All @@ -40,7 +41,11 @@ func OSSBeatDir(path ...string) string {

// Check if we need to correct ossDir because it's in x-pack.
if parentDir := filepath.Base(filepath.Dir(ossDir)); parentDir == "x-pack" {
ossDir = filepath.Join(ossDir, "../..", BeatName)
// If the OSS version of the beat exists.
tmp := filepath.Join(ossDir, "../..", BeatName)
if _, err := os.Stat(tmp); !os.IsNotExist(err) {
ossDir = tmp
}
}

return filepath.Join(append([]string{ossDir}, path...)...)
Expand Down
Loading

0 comments on commit 82ef722

Please sign in to comment.