reference Environment variables

OPENGREP_LOG_TAGS

Also spelled
SEMGREP_LOG_TAGS
Value
comma-separated tag names, or all
See also
OPENGREP_LOG_LEVEL

Debug messages can carry tags; those of Opengrep itself carry the tag default. By default, a debug message is shown only when it is tagged default. The variable replaces that list: a debug message is shown when it carries one of the named tags, and all shows every debug message.

Only debug messages are filtered by tag. Info messages, warnings and errors depend on the log level alone, and the level also decides whether debug messages are shown at all: the tags narrow what --debug shows, and do not enable it.

The first of PYTEST_OPENGREP_LOG_TAGS, OPENGREP_LOG_TAGS, PYTEST_SEMGREP_LOG_TAGS and SEMGREP_LOG_TAGS that is set takes precedence.

Examples

Hiding the debug messages, keeping the rest

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 -q '\[DEBUG\]' && echo shown || echo hidden
shown
$ OPENGREP_LOG_TAGS=nosuchtag opengrep scan --config rule.yaml --debug app.py 2>&1 >/dev/null | grep -q '\[DEBUG\]' && echo shown || echo hidden
hidden
$ OPENGREP_LOG_TAGS=nosuchtag opengrep scan --config rule.yaml --debug app.py 2>&1 >/dev/null | grep -q '\[INFO\]' && echo shown || echo hidden
shown

No debug message carries the tag nosuchtag, so no debug message is shown. The info messages are not affected.