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 46 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

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 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 and others added 18 commits December 5, 2024 13:33
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
Co-authored-by: Yaniv Agman <yanivagman@gmail.com>
@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
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