To collect all relevant logs for a scan, follow these instructions. All log output options apply to bothDocumentation Index
Fetch the complete documentation index at: https://docs.semgrep.dev/llms.txt
Use this file to discover all available pages before exploring further.
semgrep scan and semgrep ci. All examples use semgrep ci for simplicity, and name the output file as semgrep.log.
Capturing full log output
To store the entire Semgrep log for a scan, including the findings:Separating findings and other logs
Sometimes it’s helpful to separate findings from other scan logs. Using the following commands separates the two and allows for independent review of findings and scan behavior. Write only findings to a file, print other logs to the terminal:findings.txt and logs to semgrep.log through either of the following commands:
Formatting findings
Semgrep can output findings in a variety of formats. By default, the findings are formatted as readable text in the terminal, but they can also be output in other formats such as JSON or SARIF. For example:semgrep.log.
The JSON schema for Semgrep’s CLI output can be found in semgrep/semgrep-interfaces.In addition to findings formats, there are options to add details of the data flow (
--dataflow-traces) or explanations of rule matching (--matching-explanations). These are less frequently used in overall scan troubleshooting, but can be helpful for understanding findings.
Logging verbosity options
Semgrep has three commonly used log levels.- Default: Prints scan progress, findings, and errors or warnings.
- Verbose (
-vor--verbose): Adds list of rules and other details such as skipped files. - Debug (
--debug): Logs entire scan process at a very high level of detail.
-q). This is not recommended when troubleshooting.