-
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
Add Suricata module to Filebeat #8693
Merged
Merged
Changes from 19 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
33e7c59
Import suricata module from temp repo
a4da08b
Generated doc (no actual documentation for it the module yet)
3cfcc11
Update the kibana objects to the new format.
9652a66
Remove symlink to Suricata module and re-generate the doc
167aacf
Add a simple compatibility comment in the doc.
a1d05e0
Ooops, off by 3 error. Version 4.0.4 :-)
2ba9706
Package filebeat x-pack modules in the non-oss distribution
adriansr 3ab125f
Add modules.d to filebeat's x-pack tree
adriansr 0211eda
Fix build in feature-suricata branch (#8625)
adriansr 4d60173
[Suricata] Update fields and paths (#8550)
adriansr 69cce4c
Filebeat X-Pack Module Packaging (#8615)
andrewkroh 2430239
Use naming conventions for the Suricata dashboards (#8675)
tsg c8d1ab7
Add ingest-user-agent to the required plugins list (#8674)
adriansr a4fbb4d
Add integration tests for suricata module (#8650)
adriansr 3e2f40b
Merge branch 'master' of github.com:elastic/beats into feature-suricata
andrewkroh 576bb2d
Format magefile.go for x-pack/filebeat
andrewkroh 563a289
rely on go to resolve beats repo for goimports install
andrewkroh 8033e99
Update CHANGELOG files
andrewkroh 3a5ef22
Merge branch 'master' of github.com:elastic/beats into feature-suricata
andrewkroh 0f33ff3
Clean-up module documentation
andrewkroh ed53c42
Update config file
andrewkroh 96bc0f7
Fix xpack role on docs
andrewkroh 73936dd
Merge branch 'master' of github.com:elastic/beats into feature-suricata
andrewkroh 151572b
Fix heartbeat test
andrewkroh c239c8d
Remove system-test symlinks
andrewkroh b808dc0
Remove system-test symlinks - take 2
andrewkroh ab7266c
Fix permissions
andrewkroh 9b4f8e8
Undo symlink deletion
andrewkroh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package main | ||
|
||
import ( | ||
"bytes" | ||
"flag" | ||
"fmt" | ||
"go/format" | ||
"io/ioutil" | ||
"log" | ||
"os" | ||
"path" | ||
|
||
"github.com/elastic/beats/libbeat/asset" | ||
"github.com/elastic/beats/libbeat/generator/fields" | ||
"github.com/elastic/beats/licenses" | ||
) | ||
|
||
var usageText = ` | ||
Usage: module_fields [flags] [module-dir] | ||
module_fields generates a fields.go file containing a copy of the module's | ||
field.yml data in a format that can be embedded in Beat's binary. module-dir | ||
should be the directory containing modules (e.g. filebeat/module). | ||
Options: | ||
`[1:] | ||
|
||
var ( | ||
beatName string | ||
license string | ||
) | ||
|
||
func init() { | ||
flag.StringVar(&beatName, "beat", "", "Name of the beat. (Required)") | ||
flag.StringVar(&license, "license", "ASL2", "License header for generated file.") | ||
flag.Usage = usageFlag | ||
} | ||
|
||
func main() { | ||
log.SetFlags(0) | ||
flag.Parse() | ||
|
||
if beatName == "" { | ||
log.Fatal("You must use -beat to specify the beat name.") | ||
} | ||
|
||
license, err := licenses.Find(license) | ||
if err != nil { | ||
log.Fatalf("Invalid license specifier: %v", err) | ||
} | ||
|
||
args := flag.Args() | ||
if len(args) != 1 { | ||
log.Fatal("module-dir must be passed as an argument.") | ||
} | ||
dir := args[0] | ||
|
||
modules, err := fields.GetModules(dir) | ||
if err != nil { | ||
log.Fatalf("Error fetching modules: %v", err) | ||
} | ||
|
||
for _, module := range modules { | ||
files, err := fields.CollectFiles(module, dir) | ||
if err != nil { | ||
log.Fatalf("Error fetching files for module %v: %v", module, err) | ||
} | ||
|
||
data, err := fields.GenerateFieldsYml(files) | ||
if err != nil { | ||
log.Fatalf("Error fetching files for module %v: %v", module, err) | ||
} | ||
|
||
encData, err := asset.EncodeData(string(data)) | ||
if err != nil { | ||
log.Fatalf("Error encoding the data: %v", err) | ||
} | ||
|
||
var buf bytes.Buffer | ||
asset.Template.Execute(&buf, asset.Data{ | ||
License: license, | ||
Beat: beatName, | ||
Name: module, | ||
Data: encData, | ||
Package: module, | ||
}) | ||
|
||
bs, err := format.Source(buf.Bytes()) | ||
if err != nil { | ||
log.Fatalf("Error creating golang file from template: %v", err) | ||
} | ||
|
||
err = ioutil.WriteFile(path.Join(dir, module, "fields.go"), bs, 0644) | ||
if err != nil { | ||
log.Fatalf("Error writing fields.go: %v", err) | ||
} | ||
} | ||
} | ||
|
||
func usageFlag() { | ||
fmt.Fprintf(os.Stderr, usageText) | ||
flag.PrintDefaults() | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Was at first surprised by this long dev changelog but it seems all of these actually go into this PR.