Skip to content

Commit

Permalink
Test with a right-trim state machine
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansr committed Mar 26, 2020
1 parent 688b5da commit b8b1c0e
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 40 deletions.
9 changes: 8 additions & 1 deletion x-pack/filebeat/processors/decode_cef/cef/cef.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ import (

// Parser is generated from a ragel state machine using the following command:
//go:generate ragel -Z -G1 cef.rl -o parser.go
//go:generate ragel -Z -G1 trim.rl -o trim.go
//go:generate goimports -l -w parser.go

//go:generate goimports -l -w trim.go
//
// Run go vet and remove any unreachable code in the generated parser.go.
// The go generator outputs duplicated goto statements sometimes.
//
// An SVG rendering of the state machine can be viewed by opening cef.svg in
// Chrome / Firefox.
//go:generate ragel -V -p cef.rl -o cef.dot
//go:generate dot -T svg cef.dot -o cef.svg
//go:generate ragel -V -p trim.rl -o trim.dot
//go:generate dot -T svg trim.dot -o trim.svg

// Field is CEF extension field value.
type Field struct {
Expand Down
2 changes: 2 additions & 0 deletions x-pack/filebeat/processors/decode_cef/cef/cef.rl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (

// unpack unpacks a CEF message.
func (e *Event) unpack(data string) error {
data = trimTrailingSpace(data)

cs, p, pe, eof := 0, 0, len(data), len(data)
mark := 0

Expand Down
84 changes: 45 additions & 39 deletions x-pack/filebeat/processors/decode_cef/cef/parser.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b8b1c0e

Please sign in to comment.