Skip to content

Commit 6629bba

Browse files
committed
docs: enhance usage documentation with debug mode and configuration details
Adds documentation for standard and debug run modes, expands configuration options to include syscall tracing settings, and improves usage examples with clearer explanations of operation modes.
1 parent 8cb9d08 commit 6629bba

2 files changed

Lines changed: 121 additions & 4 deletions

File tree

README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ uv pip install git+https://github.com/ParttimeWorks/linux_edr.git@v1.0.0
3535
## Usage
3636

3737
```bash
38-
# Basic monitoring with default settings
38+
# Basic monitoring with default settings (requires root)
3939
sudo uv run python -m linux_edr.cli run
4040

41+
# Run in debug mode to see detailed event logs
42+
sudo uv run python -m linux_edr.cli run --debug
43+
4144
# Custom interval and output file
4245
sudo uv run python -m linux_edr.cli run --interval 5 --output events.jsonl
4346

@@ -48,6 +51,23 @@ sudo uv run python -m linux_edr.cli run --config /etc/linux_edr/custom.ini
4851
sudo uv run python -m linux_edr.cli show-config
4952
```
5053

54+
### Standard Run Mode
55+
56+
When run in standard mode, the tool will:
57+
1. Enable syscall tracing for configured events (execve, fork, clone, connect by default)
58+
2. Initialize the scheduler with the configured interval
59+
3. Start monitoring in the background
60+
4. Display minimal output
61+
62+
### Debug Run Mode
63+
64+
In debug mode, the tool will:
65+
1. Provide more detailed output during initialization
66+
2. Show each raw event as it's captured
67+
3. Display more information about scheduler operations
68+
69+
This is useful for troubleshooting or understanding what data is being collected.
70+
5171
## Data Structure
5272

5373
Linux EDR groups execve events by process name and maintains the full command line for context:
@@ -85,9 +105,6 @@ model = gpt-4o-mini
85105
# Enable debug logging (true/false)
86106
debug = false
87107

88-
# Path to save JSON reports (empty for no file output)
89-
output_file =
90-
91108
[OPENAI]
92109
# Your OpenAI API key (or leave empty to use environment variable)
93110
api_key =
@@ -105,6 +122,18 @@ max_summary_lines = 50
105122

106123
# Whether to include raw event data in reports (true/false)
107124
include_raw_events = true
125+
126+
# Whether to include security findings in reports (true/false)
127+
include_security_findings = true
128+
129+
# Whether to log verbose raw event data in debug mode (true/false)
130+
verbose_debug_logging = true
131+
132+
# Whether to enable syscall tracing (true/false)
133+
enable_syscall_tracing = true
134+
135+
# Comma-separated list of syscalls to trace (enter and exit events will be enabled)
136+
syscalls_to_trace = execve,fork,clone,connect
108137
```
109138

110139
## Hierarchical Reporting Architecture

docs/usage.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,101 @@ The Linux EDR tool can be run directly using the Python module.
88
# Basic monitoring with default settings (requires root)
99
sudo uv run python -m linux_edr.cli run
1010

11+
# Run in debug mode to see detailed event logs
12+
sudo uv run python -m linux_edr.cli run --debug
13+
1114
# Custom 5-minute reporting interval and save reports to a file
1215
sudo uv run python -m linux_edr.cli run --interval 5 --output /var/log/linux-edr-events.jsonl
1316

1417
# Use a specific configuration file
1518
sudo uv run python -m linux_edr.cli run --config /etc/linux_edr/my_config.ini
1619
```
1720

21+
### Standard Run Mode
22+
23+
When run in standard mode, the tool will:
24+
1. Enable syscall tracing for configured events (execve, fork, clone, connect by default)
25+
2. Initialize the scheduler with the configured interval
26+
3. Start monitoring in the background
27+
4. Display minimal output
28+
29+
Example output:
30+
```
31+
Enabling ftrace event: /sys/kernel/tracing/events/syscalls/sys_enter_execve/enable
32+
Enabling ftrace event: /sys/kernel/tracing/events/syscalls/sys_exit_execve/enable
33+
Enabling ftrace event: /sys/kernel/tracing/events/syscalls/sys_enter_fork/enable
34+
Enabling ftrace event: /sys/kernel/tracing/events/syscalls/sys_exit_fork/enable
35+
Enabling ftrace event: /sys/kernel/tracing/events/syscalls/sys_enter_clone/enable
36+
Enabling ftrace event: /sys/kernel/tracing/events/syscalls/sys_exit_clone/enable
37+
Enabling ftrace event: /sys/kernel/tracing/events/syscalls/sys_enter_connect/enable
38+
Enabling ftrace event: /sys/kernel/tracing/events/syscalls/sys_exit_connect/enable
39+
Successfully enabled 8 syscall trace events
40+
Adding job tentatively -- it will be properly scheduled when the scheduler starts
41+
Linux EDR initialized with interval=15m
42+
Added job "LinuxEDRApp._summarize" to job store "default"
43+
Scheduler started
44+
```
45+
46+
### Debug Run Mode
47+
48+
In debug mode, the tool will:
49+
1. Provide more detailed output during initialization
50+
2. Show each raw event as it's captured
51+
3. Display more information about scheduler operations
52+
53+
This is useful for troubleshooting or understanding what data is being collected.
54+
55+
## Configuration File
56+
57+
Linux EDR uses a `config.ini` file with the following sections and options:
58+
59+
```ini
60+
[DEFAULT]
61+
# Path to the kernel trace_pipe
62+
trace_path = /sys/kernel/tracing/trace_pipe
63+
64+
# Report generation interval in minutes
65+
report_interval = 15
66+
67+
# LLM model to use
68+
model = gpt-4o-mini
69+
70+
# Enable debug logging (true/false)
71+
debug = false
72+
73+
[OPENAI]
74+
# Your OpenAI API key (or leave empty to use environment variable)
75+
api_key =
76+
77+
[REPORTS]
78+
# Directory to store hierarchical reports
79+
reports_dir = reports
80+
81+
[ADVANCED]
82+
# Maximum number of events to store before generating an interim report
83+
max_events_buffer = 10000
84+
85+
# Maximum number of summary lines to include in LLM prompt
86+
max_summary_lines = 50
87+
88+
# Whether to include raw event data in reports (true/false)
89+
include_raw_events = true
90+
91+
# Whether to include security findings in reports (true/false)
92+
include_security_findings = true
93+
94+
# Whether to log verbose raw event data in debug mode (true/false)
95+
verbose_debug_logging = true
96+
97+
# Whether to enable syscall tracing (true/false)
98+
enable_syscall_tracing = true
99+
100+
# Comma-separated list of syscalls to trace (enter and exit events will be enabled)
101+
syscalls_to_trace = execve,fork,clone,connect
102+
```
103+
104+
You can customize this file and specify its location using the `--config` parameter when running the tool.
105+
18106
## Viewing Configuration
19107

20108
To see the effective configuration (after loading defaults, file settings, and command-line overrides):

0 commit comments

Comments
 (0)