跪拜 Guibai
← All articles
Backend

A Log Analysis Assistant Built on Lanyun MaaS Turns Scattered Errors into Actionable Fault Chains

By 倔强的石头_ ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Log analysis tools that produce unstructured chat answers create more noise than value. This approach shows how to constrain a model into a verifiable workflow where every conclusion links back to a specific log line, speculation is labeled, and the output is machine-readable JSON ready for automation.

Summary

A new log analysis assistant processes uploaded or pasted logs through a local Flask app that calls Lanyun MaaS's Qwen3.7-Plus model. Instead of generating freeform explanations, the tool constrains output to a structured format: overall risk level, anomaly types with confidence scores, verbatim log evidence, possible causes explicitly marked as speculation, and concrete investigation actions. The local program handles file encoding, line numbering, and length truncation, while the model handles semantic understanding and anomaly merging.

Five test scenarios validate the tool's behavior. An 8-line error log is correctly linked into a database connection pool exhaustion chain. A 12-line INFO-only log returns no anomalies, proving the model won't fabricate faults. Repeated errors across 15 lines are merged into three event patterns rather than listed individually. A 420-line truncated input triggers an explicit warning that the analysis covers only a partial view. A sanitized production-style log with authentication failures and circuit-breaker events is correctly split by service.

The tool exports structured JSON with fields like evidence, confidence, and actions, making the output suitable for downstream alerting or ticketing systems. Lanyun MaaS provides the model selection console, OpenAI-compatible API endpoint, and separate key management that let the project integrate without rewriting existing SDK-based code.

Takeaways
Output is constrained to five structured fields: summary, risk level, anomalies with evidence, possible causes marked as speculation, and next-step actions.
Evidence must be verbatim excerpts from the input log, making every conclusion traceable to its source.
The model returns an empty anomaly array for normal logs rather than fabricating faults to fill the page.
Repeated errors across multiple lines are merged into event patterns instead of being listed as separate anomalies.
Truncated input triggers an explicit warning that the analysis covers only a partial view of the logs.
Structured JSON output includes confidence scores, evidence, and actions, making it suitable for downstream alerting or ticketing systems.
Lanyun MaaS provides an OpenAI-compatible endpoint, so existing Python SDK code integrates by changing only the base URL and API key.
The Model Plaza console displays capability labels, context length, and tiered pricing together, letting developers weigh cost against capacity before committing.
Conclusions

Most log analysis demos stop at generating a natural-language answer; this tool's real contribution is enforcing a schema that separates fact from speculation and ties every claim to a source line.

The five test scenarios are deliberately adversarial: they check not just whether the model finds errors, but whether it stays silent when logs are clean, merges repetition, and admits when input is incomplete.

Separating the local program's responsibilities (encoding, truncation, validation) from the model's (semantic understanding) creates an auditable pipeline where neither side can silently corrupt the output.

Structured JSON output is the bridge between a human-readable dashboard and an automated workflow; without it, the tool remains a one-off debugging aid rather than a component in an ops pipeline.

Concepts & terms
Lanyun MaaS
A Chinese Model-as-a-Service platform that provides a unified console for selecting large language models, managing API keys, and accessing them through OpenAI-compatible endpoints with transparent tiered pricing.
Qwen3.7-Plus
A cost-effective model in Alibaba's Qwen3.7 series with a 1024k-token context window and visual understanding capabilities, used here for text-based log analysis and structured JSON output.
Fault chain
A sequence of causally related errors where one failure triggers downstream failures; the tool's goal is to identify which error is closest to the root cause rather than listing all errors independently.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗