reference Environment variables

OPENGREP_LOG_SRCS

Also spelled
SEMGREP_LOG_SRCS
Value
comma-separated regular expressions
See also
--debug, OPENGREP_LOG_LEVEL

Log messages come from sources: the application code of Opengrep, and named components such as semgrep.targeting, networking.http, cohttp.lwt.client or tls.config. By default, only the messages of the application are shown; --debug lists the other sources as Skipping logs for <name>.

The variable names the sources whose messages are shown as well, as comma-separated regular expressions, each matched anywhere in the name of a source. The log level still applies: a source enabled this way shows only the messages at or above the level set by --verbose, --debug or OPENGREP_LOG_LEVEL.

The first of PYTEST_OPENGREP_LOG_SRCS, OPENGREP_LOG_SRCS, PYTEST_SEMGREP_LOG_SRCS and SEMGREP_LOG_SRCS that is set takes precedence.

Examples

The logs of the targeting code

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
app.py
eval(1)
Command and result
$ opengrep scan --config rule.yaml --debug app.py 2>&1 >/dev/null | grep -c '(semgrep.targeting)'
0
$ OPENGREP_LOG_SRCS=semgrep.targeting opengrep scan --config rule.yaml --debug app.py 2>&1 >/dev/null | grep '(semgrep.targeting)' | head -2
[00.04][DEBUG](default)(semgrep.targeting): group_scanning_roots_by_project [app.py]
[00.04][DEBUG](default)(semgrep.targeting): Find_target.get_targets_for_project