get_notebook_driver_logs
Retrieve Spark driver logs from completed notebook executions to debug Python errors and analyze Spark behavior. Use stdout for Python tracebacks or stderr for system logs.
Instructions
Get Spark driver logs for a notebook execution.
Retrieves the driver logs (stdout or stderr) from a completed notebook run. This is particularly useful for getting detailed error messages and Python tracebacks when a notebook fails.
Important Notes:
Python exceptions and tracebacks appear in
stdout, notstderrstderrcontains Spark/system logs (typically larger)For failed notebooks, check
stdoutfirst for the Python errorLook for "Error", "Exception", "Traceback" in the output
Use this tool when:
A notebook execution failed and you need to see the Python error
You want to debug notebook issues by examining driver logs
You need to analyze Spark driver behavior (stderr)
Parameters: workspace_name: The display name of the workspace containing the notebook. notebook_name: Name of the notebook. job_instance_id: The job instance ID from execute_notebook or run_on_demand_job result. log_type: Type of log to retrieve - "stdout" (default) or "stderr". Use "stdout" for Python errors and print statements. Use "stderr" for Spark/system logs. max_lines: Maximum number of lines to return (default: 500, None for all). Returns the last N lines (most recent, where errors typically are).
Returns: Dictionary with: - status: "success" or "error" - message: Description of the result - log_type: Type of log retrieved - log_content: The actual log content as a string - log_size_bytes: Total size of the log file - truncated: Whether the log was truncated - spark_application_id: The Spark application ID - livy_id: The Livy session ID
Example: ```python # Get Python error from a failed notebook result = get_notebook_driver_logs( workspace_name="Analytics", notebook_name="ETL_Pipeline", job_instance_id="12345678-1234-1234-1234-123456789abc", log_type="stdout" # Python errors are in stdout! )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace_name | Yes | ||
| notebook_name | Yes | ||
| job_instance_id | Yes | ||
| log_type | No | stdout | |
| max_lines | No |