Skip to content

Commit 6a088b3

Browse files
authored
chore: Raw event parsing and performance optimizations (#126)
* raw event parsing * reading UTF16 encoded strings * introduce version handling in raw event parsers, refactor trace controller * remove ignored params map * introduce Kparams constructor with variadic args * use the regular `if` conditional operator for version handling * implement event schema version checking * add ktype descriptions, include raw event parsing test * fix failing tests, disable filament build flag * fix tests and lint warnings * more fixing/polishing * check if param is hex before coercing * add filament build flags for the cpython code
1 parent dacbb80 commit 6a088b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1441
-540
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ indent_size = 2
1111

1212
[{go.mod,go.sum,*.go}]
1313
indent_style = tab
14-
indent_size = 8
14+
indent_size = 4
1515

1616
[*.md]
1717
indent_size = 4

.github/workflows/master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ jobs:
168168
export PKG_CONFIG_PATH=$(pwd)/pkg-config
169169
./make.bat test
170170
env:
171-
TAGS: kcap,filament,yara,yara_static
171+
TAGS: kcap,yara,yara_static
172172

173173
lint:
174174
runs-on: windows-latest

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
export PKG_CONFIG_PATH=$(pwd)/pkg-config
122122
./make.bat test
123123
env:
124-
TAGS: kcap,filament,yara,yara_static
124+
TAGS: kcap,yara,yara_static
125125

126126
lint:
127127
runs-on: windows-latest

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,3 @@ jobs:
170170
build/fibratus-${{ steps.get_version.outputs.VERSION }}-slim-amd64.msi
171171
env:
172172
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173-

cmd/fibratus/app/capture_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func capture(cmd *cobra.Command, args []string) error {
9595
kstreamc.SetFilter(kfilter)
9696
}
9797

98-
err = kstreamc.OpenKstream()
98+
err = kstreamc.OpenKstream(ktracec.Traces())
9999
if err != nil {
100100
return multierror.Wrap(err, ktracec.CloseKtrace())
101101
}

cmd/fibratus/app/control_service_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func (s *fsvc) run() error {
230230
psnap := ps.NewSnapshotter(hsnap, svcConfig)
231231
consumer = kstream.NewConsumer(ctrl, psnap, hsnap, svcConfig)
232232
// open the kernel event stream, start processing events and forwarding to outputs
233-
err = consumer.OpenKstream()
233+
err = consumer.OpenKstream(ctrl.Traces())
234234
if err != nil {
235235
return err
236236
}

cmd/fibratus/app/run_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func run(cmd *cobra.Command, args []string) error {
117117
if f.Filter() != nil {
118118
kstreamc.SetFilter(f.Filter())
119119
}
120-
err = kstreamc.OpenKstream()
120+
err = kstreamc.OpenKstream(ktracec.Traces())
121121
if err != nil {
122122
return multierror.Wrap(err, ktracec.CloseKtrace())
123123
}
@@ -134,7 +134,7 @@ func run(cmd *cobra.Command, args []string) error {
134134
}
135135
}()
136136
} else {
137-
err = kstreamc.OpenKstream()
137+
err = kstreamc.OpenKstream(ktracec.Traces())
138138
if err != nil {
139139
return multierror.Wrap(err, ktracec.CloseKtrace())
140140
}

configs/fibratus.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ kstream:
175175
# collected by Kernel Logger provider
176176
#enable-handle: false
177177

178+
# Determines if raw event buffer parsing is used instead of TDH (Trace Data Helper) API
179+
# raw-event-parsing: true
180+
178181
# Determines which events are dropped either by the event name or the process' image
179182
# name that triggered the event.
180183
blacklist:

configs/rules/default/default.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,3 @@
378378
'\\Start',
379379
'CurrentVersion\\Run'
380380
)
381-

pkg/config/config_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ func (c *Config) addFlags() {
341341
c.flags.Duration(flushInterval, defaultFlushInterval, "Specifies how often the trace buffers are forcibly flushed")
342342
c.flags.StringSlice(excludedEvents, []string{}, "A list of symbolical kernel event names that will be dropped from the kernel event stream. By default all events are accepted")
343343
c.flags.StringSlice(excludedImages, []string{"System"}, "A list of image names that will be dropped from the kernel event stream. Image names are case insensitive")
344+
c.flags.Bool(rawEventParsing, true, "Determines if raw event buffer parsing is used instead of TDH (Trace Data Helper) API")
344345

345346
c.flags.Bool(serializeThreads, false, "Indicates if threads are serialized as part of the process state")
346347
c.flags.Bool(serializeImages, false, "Indicates if images are serialized as part of the process state")

0 commit comments

Comments
 (0)