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

add traceectl to tracee #4396

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open

Conversation

ShohamBit
Copy link
Collaborator

@ShohamBit ShohamBit commented Nov 25, 2024

Description

This PR introduces traceectl, a new CLI tool for interacting with Tracee. It implements basic commands for communication with Tracee via gRPC.

Key Changes

  • Added traceectl CLI tool.
  • Implemented commands for:
    • version
    • metrics
    • stream
    • event

042349a fix more issues
59e6e3c fix lint problom in traceectl
0618d49 made changes to the docs of traceectl
144cf90 resolve client creation code
0c5a8d2 fix stream code
d08c7d7 fix root command
dcd71ed fix event command code
e1eef96 tidy formmatter pkg
c55d1a9 fix flag pkg
df3501d fix client pkg
4866b0c Update cmd/traceectl/cmd/event.go
f0ec9fe Update cmd/traceectl/cmd/event.go
ee84109 Update docs/docs/traceectl/index.md
8046da8 Update docs/docs/traceectl/index.md
9680bb9 Update docs/docs/traceectl/flags/server.md
62da87d Update cmd/traceectl/cmd/event.go
2815df6 Update docs/docs/traceectl/flags/format.md
c8a1b92 Update docs/docs/traceectl/commands/version.md
93fa420 Update cmd/traceectl/cmd/event.go
a58c7ea Update cmd/traceectl/cmd/event.go
216c76e Update cmd/traceectl/cmd/event.go
a1cc925 Update cmd/traceectl/cmd/event.go
90b8ef4 added docs to mkdocs file
d717339 change default socket to /var/run/tracee.sock
795f2d9 change make bulid to go build, remove install
6dd5960 modified code to align with new status flag code, fix minor issues
0f816ba added server flag code
71db0a9 added error msg for not supported output format
30fbfe1 added docs to traceectl flags
3cfff2b ** make formt flag global**
21ac45f added metrics docs
13549c7 added stream doc
b3ed5ac added doc for event
a026f34 added version command doc
997a267 ** add white space to make the server connection a separate block.**
9184a1c added basic documantion for traceectl
0673944 support output
6fca72e fix event and remove printer pkg
b0f43a7 add support to json
77dce12 moved printer stream code to stream
d68b359 fix client and root
f33a9fa fix mock server and client
d085ca1 fix formatter
3997a6f fix client code
b3baff0 remove not support code by tracee
f27998e change design for traceectl
c1bafdf Add traceectl to tracee

4866b0c Update cmd/traceectl/cmd/event.go

Co-authored-by: Yaniv Agman <[email protected]>

f0ec9fe Update cmd/traceectl/cmd/event.go

Co-authored-by: Yaniv Agman <[email protected]>

ee84109 Update docs/docs/traceectl/index.md

Co-authored-by: Yaniv Agman <[email protected]>

8046da8 Update docs/docs/traceectl/index.md

Co-authored-by: Yaniv Agman <[email protected]>

9680bb9 Update docs/docs/traceectl/flags/server.md

Co-authored-by: Yaniv Agman <[email protected]>

62da87d Update cmd/traceectl/cmd/event.go

Co-authored-by: Yaniv Agman <[email protected]>

2815df6 Update docs/docs/traceectl/flags/format.md

Co-authored-by: Yaniv Agman <[email protected]>

c8a1b92 Update docs/docs/traceectl/commands/version.md

Co-authored-by: Yaniv Agman <[email protected]>

93fa420 Update cmd/traceectl/cmd/event.go

Co-authored-by: Yaniv Agman <[email protected]>

a58c7ea Update cmd/traceectl/cmd/event.go

Co-authored-by: Yaniv Agman <[email protected]>

216c76e Update cmd/traceectl/cmd/event.go

Co-authored-by: Yaniv Agman <[email protected]>

a1cc925 Update cmd/traceectl/cmd/event.go

Co-authored-by: Yaniv Agman <[email protected]>

Testing

  1. Compile and run Tracee with gRPC:

    make tracee
    sudo tracee --grpc-listen-addr unix:/tmp/tracee.sock
  2. Run traceectl:

    cd ./cmd/traceectl
    sudo go run main.go stream

    This displays the help command.

Current Limitations

  • metrics: JSON output is not yet supported.
  • stream: Only the base stream command is supported. Streams events directly from Tracee.

Related Issues

Copy link
Collaborator

@yanivagman yanivagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comments below.
In addition, please add documentation to traceectl.
As part of the documentation, please also refer to the way the user should start tracee "daemon" (e.g. using NONE output and setting the grpc server address)

cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/client/client.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/client/client.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/formatter/JSONFormatter.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/formatter/JSONFormatter.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/formatter/TableFormatter.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/formatter/formatter.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/printer/printer.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
@ShohamBit
Copy link
Collaborator Author

What do you think about adding a flag to traceectl version command called short for a short version instead of all the info we get, or the exact offset making the long flag and the short version the default?

@geyslan
Copy link
Member

geyslan commented Nov 28, 2024

What do you think about adding a flag to traceectl version command called short for a short version instead of all the info we get, or the exact offset making the long flag and the short version the default?

I believe we wouldn't bother with it. When it's from a released version, it's already short.

@geyslan
Copy link
Member

geyslan commented Dec 3, 2024

Gonna through this tomorrow. 👍🏻

@ShohamBit ShohamBit force-pushed the traceectl branch 2 times, most recently from 64b8a32 to 21986f0 Compare December 4, 2024 10:30
)

var (
ExpectedVersion string = "v0.22.0-15-gd09d7fca0d"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this output when writing test to version command or remove it entirely

Copy link
Collaborator Author

@ShohamBit ShohamBit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, maybe go over the documentation and review it once more

@geyslan
Copy link
Member

geyslan commented Dec 4, 2024

@ShohamBit @yanivagman what do you think about splitting this? Since we already have a working stream command, we could open a PR with just the base root and stream commands to establish a foundation for the upcoming new commands (each added in separate PRs). This approach would make both implementation and review more manageable.

@ShohamBit
Copy link
Collaborator Author

Hey @geyslan, great thinking, let's discuss this over with @yanivagman

Copy link
Collaborator

@yanivagman yanivagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass...

cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
docs/docs/traceectl/commands/version.md Outdated Show resolved Hide resolved
docs/docs/traceectl/flags/format.md Outdated Show resolved Hide resolved
docs/docs/traceectl/flags/server.md Outdated Show resolved Hide resolved
docs/docs/traceectl/index.md Outdated Show resolved Hide resolved
docs/docs/traceectl/index.md Outdated Show resolved Hide resolved
@ShohamBit ShohamBit force-pushed the traceectl branch 2 times, most recently from dd19b43 to 2159616 Compare December 8, 2024 11:45
@ShohamBit ShohamBit changed the title Add Traceectl to Tracee add traceectl to tracee Dec 8, 2024
@yanivagman yanivagman linked an issue Dec 12, 2024 that may be closed by this pull request
8 tasks
@ShohamBit ShohamBit requested a review from yanivagman December 30, 2024 07:45
ShohamBit and others added 28 commits January 8, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add New CLI: traceectl
3 participants