Skip to content

Commit cc2dc07

Browse files
committed
wip
1 parent c3dfda2 commit cc2dc07

File tree

1 file changed

+29
-0
lines changed
  • crowdsec-docs/docs/log_processor/service-discovery-setup

1 file changed

+29
-0
lines changed

crowdsec-docs/docs/log_processor/service-discovery-setup/detect-yaml.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,32 @@ detect:
8989
labels: {type: eventlog}
9090
```
9191

92+
93+
## Expression Helpers Reference
94+
95+
Expressions run against an environment that exposes helpers and facts via these names:
96+
97+
- Host — host facts from gopsutil/host.InfoStat. See https://pkg.go.dev/github.com/shirou/gopsutil/host#InfoStat
98+
Example: Host.OS == "linux".
99+
100+
- Path — filesystem helpers:
101+
- Path.Exists(path) -> bool
102+
- Path.Glob(pattern) -> []string
103+
Example: len(Path.Glob("/var/log/nginx/*.log")) > 0.
104+
105+
- System — process helpers:
106+
- System.ProcessRunning(name) -> bool (by process name)
107+
108+
- Systemd (Linux) — systemd unit helpers:
109+
- Systemd.UnitInstalled(unit) -> bool
110+
- Systemd.UnitConfig(unit, key) -> string (empty string if unit missing; error if key missing)
111+
- Systemd.UnitLogsToJournal(unit) -> bool (true if stdout/stderr go to journal or journal+console)
112+
113+
- Windows (Windows builds only):
114+
- Windows.ServiceEnabled(service) -> bool (true if the service exists and is Automatic start; returns false on non-Windows builds)
115+
116+
- Version — semantic version checks (can be used with Host.PlatformVersion):
117+
- Version.Check(version, constraint) -> bool
118+
- Supports operators like =, !=, <, <=, >, >=, ranges (1.1.1 - 1.3.4), AND with commas (>1, <3), and ~ compatible ranges.
119+
120+

0 commit comments

Comments
 (0)