How to Configure the Response Language for Multi-Language Log Analysis in LogSentinelAI
Set the RESPONSE_LANGUAGE environment variable or .env entry to control the output language of all LLM-generated summaries, recommendations, and statistical descriptions.
LogSentinelAI (call518/logsentinelai) generates AI-powered log analysis reports in multiple languages through a centralized configuration system. The response language setting determines whether the LLM outputs insights in English, Korean, Spanish, or any other supported language, ensuring consistent multilingual reporting across HTTP access logs, Apache errors, Linux system logs, and generic text files.
How Response Language Configuration Works in LogSentinelAI
The language for all generated content is controlled centrally by the RESPONSE_LANGUAGE configuration value. In src/logsentinelai/core/config.py at line 82, the system reads this setting from the environment with a default fallback to Korean:
# src/logsentinelai/core/config.py – line 82
RESPONSE_LANGUAGE = os.getenv("RESPONSE_LANGUAGE", "korean")
This global variable propagates through the analysis pipeline and ultimately determines the language token injected into every LLM prompt.
Setting the Response Language
You can configure the output language through environment variables or programmatic overrides.
Via Environment Variable or .env File
The simplest method uses a .env file in the project root or a shell environment variable. The configuration loader in src/logsentinelai/core/config.py automatically reads RESPONSE_LANGUAGE during startup when apply_config() is called.
Create or edit .env:
# .env
RESPONSE_LANGUAGE=english
For one-off runs without modifying files:
RESPONSE_LANGUAGE=spanish python -m logsentinelai.cli run --log-type httpd_access
Runtime Override in Python
For custom scripts using the Python API, modify the configuration dictionary returned by get_analysis_config():
from logsentinelai.core.config import get_analysis_config, apply_config
# Load defaults and .env file
apply_config()
# Retrieve configuration dict
config = get_analysis_config(
log_type="linux_system",
remote_mode="local",
ssh_config=None,
)
# Override language for this specific analysis
config["response_language"] = "french"
# Use config in your processing pipeline
How the Language Token Propagates Through the Pipeline
The response language flows through three key stages from configuration to LLM prompt:
-
Configuration Assembly: The
get_analysis_config()function insrc/logsentinelai/core/config.py(lines 38-44) includes the language in the returned configuration dictionary under the keyresponse_language. -
Template Preparation: Every prompt template in
src/logsentinelai/core/prompts.pycontains a language placeholder. At lines 55-57, the template includes:LANGUAGE: {response_language} -
Runtime Formatting: When preparing log chunks for analysis,
prepare_chunk_for_analysis()insrc/logsentinelai/core/commons.py(lines 20-24) substitutes the placeholder with the actual language value:prompt = prompt_template.format( logs=logs, model_schema=model_schema, response_language=response_language )
Because this is a single global setting, all log types processed in the same execution share the same output language, guaranteeing consistency across HTTP access logs, Apache error logs, and Linux system logs.
Verifying the Language Configuration
To confirm the language is correctly set before sending requests to the LLM, inspect the formatted prompt template:
from logsentinelai.core.prompts import get_linux_system_prompt
prompt_template = get_linux_system_prompt()
example_prompt = prompt_template.format(
logs="Mar 10 12:00:00 localhost sshd[1234]: Accepted password for user",
model_schema="{}",
response_language="german"
)
print(example_prompt) # Contains "LANGUAGE: german"
This verification ensures the {response_language} token is properly replaced before the LLM generates its analysis.
Summary
- Centralized control: The
RESPONSE_LANGUAGEenvironment variable (default:korean) governs all LLM output language insrc/logsentinelai/core/config.py. - Three configuration methods: Use
.envfiles, shell environment variables, or direct dictionary manipulation in Python. - Token injection: The system injects the language into prompts via the
{response_language}placeholder defined insrc/logsentinelai/core/prompts.pyand rendered insrc/logsentinelai/core/commons.py. - Global consistency: All log analyses in a single run share the same response language, ensuring uniform multilingual reporting.
Frequently Asked Questions
What languages are supported by LogSentinelAI?
LogSentinelAI supports any language the underlying LLM can generate, including English, Korean, Spanish, Chinese, French, and German. The RESPONSE_LANGUAGE value accepts free-form language names (e.g., "english", "korean") that the LLM recognizes in its instructions.
Can I analyze logs in one language and get reports in another?
Yes. The response language is independent of the input log content. You can analyze English log files while receiving AI-generated summaries in Korean or Spanish by setting RESPONSE_LANGUAGE to your desired output language. The LLM processes the log content regardless of its original language.
Where is the response language stored during execution?
The language is stored in the global configuration dictionary returned by get_analysis_config() in src/logsentinelai/core/config.py. This dictionary passes through the CLI entry point (src/logsentinelai/cli.py) down to the prompt formatting functions in src/logsentinelai/core/commons.py, ensuring the value persists throughout the analysis lifecycle.
How do I debug if the wrong language appears in outputs?
First, verify your .env file or environment variable is correctly set. Then, use the verification code snippet from the "Verifying the Language Configuration" section to print the formatted prompt and check that the LANGUAGE: line shows your intended value. If the prompt shows the correct language but the LLM responds differently, verify that your LLM provider supports multilingual outputs.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →