DavidHstar commited on
Commit
424c093
·
verified ·
1 Parent(s): ea0b2d5

Upload logsentinelai.config

Browse files
Files changed (1) hide show
  1. logsentinelai.config +263 -0
logsentinelai.config ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ####################################
2
+ # LogSentinelAI Configuration File #
3
+ ####################################
4
+
5
+ # =============================================================================
6
+ # Telegram Alert Configuration
7
+ # =============================================================================
8
+ # Enable/Disable Telegram notifications (true/false)
9
+ # When false, all Telegram alert processing is skipped for better performance
10
+ TELEGRAM_ENABLED=true
11
+
12
+ # Telegram Alert Level - Minimum severity level to trigger alerts
13
+ # Choose from: CRITICAL, HIGH, MEDIUM, LOW, INFO
14
+ # Only events with this severity level or higher will trigger Telegram alerts
15
+ # Example: If set to HIGH, only CRITICAL and HIGH events will send alerts
16
+ # Example: If set to MEDIUM, CRITICAL, HIGH, and MEDIUM events will send alerts
17
+ TELEGRAM_ALERT_LEVEL=CRITICAL
18
+
19
+ # Telegram Bot Token (required for alerting to Telegram group)
20
+ # Get from @BotFather after creating your bot
21
+ TELEGRAM_TOKEN=YOUR_TELEGRAM_BOT_TOKEN_HERE
22
+
23
+ # Telegram Chat ID (group or user)
24
+ # Use @userinfobot or similar to get your group chat ID (negative number for groups)
25
+ TELEGRAM_CHAT_ID=YOUR_TELEGRAM_CHAT_ID_HERE
26
+
27
+ # =============================================================================
28
+ # Logging Configuration
29
+ # =============================================================================
30
+
31
+ # LOG_LEVEL: Set logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
32
+ # Example: LOG_LEVEL=INFO
33
+ LOG_LEVEL=INFO
34
+
35
+ # LOG_FILE: Path to log file (leave empty for console only)
36
+ # Example: LOG_FILE=logsentinelai.log
37
+ LOG_FILE=/var/log/logsentinelai.log
38
+
39
+ # ===============================================================================
40
+ # API Keys
41
+ # =============================================================================
42
+ # OpenAI API Key (required if using OpenAI provider)
43
+ OPENAI_API_KEY=YOUR_OPENAI_API_KEY_HERE
44
+
45
+ # Gemini API Key (required if using Gemini provider)
46
+ GEMINI_API_KEY=AIzaSyCtQ-SyLUn7dyorwD_Nzq8dWLQjqV2EKb
47
+
48
+ # =============================================================================
49
+ # LLM Configuration
50
+ # =============================================================================
51
+ # LLM Provider - Choose from "ollama", "vllm", "openai", "gemini"
52
+ LLM_PROVIDER=ollama
53
+ #LLM_PROVIDER=vllm
54
+ #LLM_PROVIDER=gemini
55
+ #LLM_PROVIDER=openai
56
+
57
+ # LLM Model - Ollama
58
+ LLM_MODEL_OLLAMA=qwen3:8b
59
+ #LLM_MODEL_OLLAMA=gemma3:4b
60
+ #LLM_MODEL_OLLAMA=qwen2.5:1.5b
61
+ #LLM_MODEL_OLLAMA=qwen3:1.7b
62
+
63
+ # LLM Model - vLLM
64
+ LLM_MODEL_VLLM=Qwen/Qwen2.5-1.5B-Instruct
65
+
66
+ # LLM Model - Gemini
67
+ LLM_MODEL_GEMINI=gemini-1.5-pro
68
+ #LLM_MODEL_GEMINI=gemini-2.5-flash-lite
69
+
70
+ # LLM Model - OpenAI
71
+ #LLM_MODEL_OPENAI=gpt-4o-mini
72
+ LLM_MODEL_OPENAI=gpt-4.1-nano
73
+
74
+ # Ollama API Host Configuration (default: http://127.0.0.1:11434/v1)
75
+ # (OpenAI API compatibility)
76
+ LLM_API_HOST_OLLAMA=http://192.168.140.198:11434/v1
77
+
78
+ # vLLM API host (default: http://127.0.0.1:5000/v1)
79
+ # (OpenAI API compatibility)
80
+ LLM_API_HOST_VLLM=http://127.0.0.1:5000/v1
81
+
82
+ # OpenAI API host (default: https://api.openai.com/v1)
83
+ LLM_API_HOST_OPENAI=https://api.openai.com/v1
84
+
85
+ # Gemini API host
86
+ # (OpenAI API compatibility)
87
+ LLM_API_HOST_GEMINI=https://generativelanguage.googleapis.com/v1beta/openai/
88
+
89
+ # LLM Generation Parameters
90
+ # Temperature: Controls randomness (0.0 = deterministic, 1.0 = very random)
91
+ # Recommended: 0.0-0.1 for log analysis (consistency), 0.7-0.9 for creative tasks
92
+ LLM_TEMPERATURE=0.1
93
+
94
+ # Top-p: Controls diversity via nucleus sampling (0.1-1.0)
95
+ # Lower values = more focused, Higher values = more diverse
96
+ LLM_TOP_P=0.3
97
+
98
+ # Max Tokens: Maximum number of tokens to generate in response
99
+ # Controls response length and prevents infinite generation
100
+ # Recommended: 1024-4096 for log analysis depending on complexity
101
+ LLM_MAX_TOKENS=4096
102
+
103
+ # Show Prompt: Display the full prompt sent to LLM before processing (true/false)
104
+ # Set to true to see the complete prompt for debugging and transparency
105
+ # Useful for debugging prompt issues and understanding what's sent to the LLM
106
+ LLM_SHOW_PROMPT=true
107
+
108
+ # =============================================================================
109
+ # Analysis Configuration
110
+ # =============================================================================
111
+ # Response Language - Choose from "english", "korean", etc..
112
+ RESPONSE_LANGUAGE=english
113
+
114
+ # Analysis Mode - Choose from "batch", "realtime"
115
+ # batch: Analyze complete log files (existing functionality)
116
+ # realtime: Monitor and analyze new log entries as they are written
117
+ ANALYSIS_MODE=batch
118
+
119
+ # =============================================================================
120
+ # Log File Paths
121
+ # =============================================================================
122
+ # Default log file paths used when --log-path is not specified
123
+ LOG_PATH_HTTPD_ACCESS=/workspace/LogSentinelAI/sample-logs/access-10k.log
124
+ LOG_PATH_HTTPD_SERVER=/workspace/LogSentinelAI/sample-logs/apache-10k.log
125
+ LOG_PATH_LINUX_SYSTEM=/workspace/LogSentinelAI/sample-logs/linux-2k.log
126
+ LOG_PATH_GENERAL_LOG=/var/log/secure
127
+
128
+ # =============================================================================
129
+ # Chunk Size Configuration (entries per chunk)
130
+ # =============================================================================
131
+ # CHUNK_SIZE: Number of log entries sent to LLM for analysis in a single request
132
+ # - Controls analysis quality vs performance balance
133
+ # - Larger values: Better context understanding, slower processing
134
+ # - Smaller values: Faster processing, may miss complex patterns
135
+ # - Recommended: 10-50 depending on log complexity and LLM capacity
136
+ # - These values are used for both batch and real-time modes
137
+ # CLI Override: Use --chunk-size argument to override these values
138
+ # Example: python analysis-linux-system-log.py --chunk-size 20
139
+ CHUNK_SIZE_HTTPD_ACCESS=10
140
+ CHUNK_SIZE_HTTPD_SERVER=10
141
+ CHUNK_SIZE_LINUX_SYSTEM=10
142
+ CHUNK_SIZE_GENERAL_LOG=10
143
+
144
+ # =============================================================================
145
+ # Elasticsearch Configuration
146
+ # =============================================================================
147
+ ELASTICSEARCH_HOST=http://localhost:9200
148
+ ELASTICSEARCH_USER=elastic
149
+ ELASTICSEARCH_PASSWORD=password
150
+ ELASTICSEARCH_INDEX=logsentinelai-analysis
151
+
152
+ # =============================================================================
153
+ # Real-time Monitoring Configuration
154
+ # =============================================================================
155
+ # Remote Log Access Mode - Choose from "local", "ssh"
156
+ # local: Monitor local log files (default)
157
+ # ssh: Monitor remote log files via SSH connection
158
+ REMOTE_LOG_MODE=local
159
+
160
+ # SSH Remote Server Configuration (only used when REMOTE_LOG_MODE=ssh)
161
+ # SSH connection details for remote log monitoring
162
+ REMOTE_SSH_HOST=
163
+ REMOTE_SSH_PORT=22
164
+ REMOTE_SSH_USER=
165
+ # SSH Key Authentication (recommended for security)
166
+ REMOTE_SSH_KEY_PATH=
167
+ # Password Authentication (less secure, use only if SSH key is not available)
168
+ REMOTE_SSH_PASSWORD=
169
+ # SSH Connection Timeout (seconds)
170
+ REMOTE_SSH_TIMEOUT=10
171
+
172
+ # Polling interval for checking new log entries (seconds)
173
+ # - How often to check log files for new content
174
+ # - Lower values: More responsive, higher CPU usage
175
+ # - Higher values: Less responsive, lower CPU usage
176
+ REALTIME_POLLING_INTERVAL=5
177
+
178
+ # Maximum number of new lines to process at once (I/O efficiency control)
179
+ # - Limits memory usage and prevents system overload
180
+ # - Controls how many lines are read from file system per polling cycle
181
+ # - IMPORTANT: This is different from CHUNK_SIZE (which controls LLM analysis batching)
182
+ # - If 1000 new lines appear, this setting reads only 50 lines per cycle
183
+ # - Remaining lines are processed in subsequent polling cycles
184
+ # - Recommended: 20-100 depending on system resources and log volume
185
+ REALTIME_MAX_LINES_PER_BATCH=50
186
+
187
+ # Buffer time to wait for complete log lines (seconds)
188
+ # - Prevents processing incomplete log lines that are still being written
189
+ # - When new lines are detected, waits this many seconds before processing
190
+ # - Ensures log entries are completely written to disk before analysis
191
+ # - Higher values: More safety against incomplete lines, slower responsiveness
192
+ # - Lower values: Faster processing, risk of reading partial log entries
193
+ # - Recommended: 1-5 seconds depending on log writing frequency
194
+ REALTIME_BUFFER_TIME=2
195
+
196
+ # Real-time processing mode - Choose from "full", "sampling"
197
+ # full: Process all accumulated logs sequentially (default)
198
+ # sampling: Only process the most recent chunk_size logs, discard older ones
199
+ # CLI Override: Use --processing-mode argument to override this setting
200
+ # Example: python analysis-linux-system-log.py --mode realtime --processing-mode sampling
201
+ REALTIME_PROCESSING_MODE=full
202
+
203
+ # Chunk pending timeout (seconds) for forcing pending logs to be processed
204
+ # - Maximum time to wait for chunk_size logs to accumulate before processing
205
+ # - If pending logs exist but chunk_size is not reached within this time, process anyway
206
+ # - Prevents pending logs from waiting indefinitely in low-volume environments
207
+ # - Set to 0 to disable timeout (wait indefinitely for full chunks)
208
+ # - Recommended: 600-3600 seconds (10-60 minutes) depending on log volume and analysis urgency
209
+ REALTIME_CHUNK_PENDING_TIMEOUT=600
210
+
211
+ # Auto-sampling threshold (applies to full mode)
212
+ # Automatically switch to sampling if accumulated lines exceed this number
213
+ # - When pending lines exceed this threshold, automatically switch to sampling mode
214
+ # - Prevents memory buildup in high-volume log environments
215
+ # - Works with CHUNK_SIZE: if CHUNK_SIZE=10 and threshold=100, keeps latest 10 lines
216
+ # CLI Override: Use --sampling-threshold argument to override this setting
217
+ # Example: python analysis-linux-system-log.py --mode realtime --sampling-threshold 200
218
+ REALTIME_SAMPLING_THRESHOLD=100
219
+
220
+ # FLOW EXPLANATION:
221
+ # 1. Every REALTIME_POLLING_INTERVAL seconds, check log file for new lines
222
+ # 2. Read up to REALTIME_MAX_LINES_PER_BATCH lines from file system
223
+ # 3. Add these lines to pending buffer (internal queue)
224
+ # 4. When pending buffer reaches CHUNK_SIZE lines, send to LLM for analysis
225
+ # 5. If pending buffer exceeds REALTIME_SAMPLING_THRESHOLD, apply sampling
226
+ # 6. If pending logs exist but CHUNK_SIZE not reached within REALTIME_CHUNK_PENDING_TIMEOUT seconds, force process anyway
227
+ #
228
+ # Example with current settings:
229
+ # - Check file every 5 seconds
230
+ # - Read max 50 lines per check
231
+ # - Analyze when 10 lines accumulated (CHUNK_SIZE)
232
+ # - Apply sampling if 100+ lines pending (REALTIME_SAMPLING_THRESHOLD)
233
+ # - Force process pending logs after 1800 seconds (30 minutes) timeout (REALTIME_CHUNK_PENDING_TIMEOUT)
234
+
235
+ # Note: Real-time monitoring will buffer new log lines until CHUNK_SIZE lines
236
+ # are accumulated before sending to LLM for analysis. This improves efficiency
237
+ # by avoiding single-line analysis calls. However, if logs don't reach CHUNK_SIZE
238
+ # within the timeout period, they will be processed anyway to prevent indefinite waiting.
239
+
240
+ # =============================================================================
241
+ # GeoIP Configuration
242
+ # =============================================================================
243
+
244
+ # Enable GeoIP enrichment of source IP addresses with city/location information
245
+ # When enabled, source_ips and related fields in analysis results will include city, country, and coordinates (geo_point)
246
+ GEOIP_ENABLED=true
247
+
248
+ # Path to MaxMind GeoLite2-City database file (.mmdb format)
249
+ # Download with: python -m logsentinelai.utils.geoip_downloader
250
+ # Default: ~/.logsentinelai/GeoLite2-City.mmdb (automatically downloaded if missing)
251
+ GEOIP_DATABASE_PATH=~/.logsentinelai/GeoLite2-City.mmdb
252
+
253
+ # Fallback country name for unknown IP addresses
254
+ GEOIP_FALLBACK_COUNTRY=Unknown
255
+
256
+ # Include private/internal IP addresses in GeoIP processing
257
+ # When false, private IPs (192.168.x.x, 10.x.x.x, etc.) are marked as "Private IP"
258
+ # When true, private IPs are processed through GeoIP database (usually results in "Unknown")
259
+ GEOIP_INCLUDE_PRIVATE_IPS=false
260
+
261
+ # Size of GeoIP lookup cache (number of IP addresses to cache)
262
+ # Higher values reduce database queries but consume more memory
263
+ GEOIP_CACHE_SIZE=1000