BE: /logs endpoint, comments resolution, github template

Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
jokob-sk
2025-11-10 07:58:21 +11:00
parent 8483a741b4
commit 6d70a8a71d
4 changed files with 27 additions and 13 deletions

View File

@@ -46,7 +46,7 @@ body:
attributes: attributes:
label: app.conf label: app.conf
description: | description: |
Paste your `app.conf` (remove personal info) Paste relevant `app.conf`settings (remove sensitive info)
render: python render: python
validations: validations:
required: false required: false
@@ -70,6 +70,13 @@ body:
- Bare-metal (community only support - Check Discord) - Bare-metal (community only support - Check Discord)
validations: validations:
required: true required: true
- type: checkboxes
attributes:
label: Debug or Trace enabled
description: I confirm I set `LOG_LEVEL` to `debug` or `trace`
options:
- label: I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.
required: true
- type: textarea - type: textarea
attributes: attributes:
label: app.log label: app.log
@@ -78,13 +85,14 @@ body:
***Generally speaking, all bug reports should have logs provided.*** ***Generally speaking, all bug reports should have logs provided.***
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
Additionally, any additional info? Screenshots? References? Anything that will give us more context about the issue you are encountering! Additionally, any additional info? Screenshots? References? Anything that will give us more context about the issue you are encountering!
You can use `tail -100 /app/log/app.log` in the container if you have trouble getting to the log files. You can use `tail -100 /app/log/app.log` in the container if you have trouble getting to the log files or send them to netalertx@gmail.com with the issue number.
validations: validations:
required: false required: false
- type: checkboxes - type: textarea
attributes: attributes:
label: Debug enabled label: Docker Logs
description: I confirm I enabled `debug` description: |
options: You can retrieve the logs from Portainer -> Containers -> your NetAlertX container -> Logs or by running `sudo docker logs netalertx`.
- label: I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs. validations:
required: true required: true

View File

@@ -181,8 +181,10 @@ def main():
# make sure the file has the correct name (e.g last_result.encoded.Node_1.1.log) to skip any otehr plugin files # make sure the file has the correct name (e.g last_result.encoded.Node_1.1.log) to skip any otehr plugin files
if len(file_name.split('.')) > 2: if len(file_name.split('.')) > 2:
# Store e.g. Node_1 from last_result.encoded.Node_1.1.log # Extract node name from either last_result.decoded.Node_1.1.log or last_result.Node_1.log
syncHubNodeName = file_name.split('.')[1] parts = file_name.split('.')
# If decoded/encoded file, node name is at index 2; otherwise at index 1
syncHubNodeName = parts[2] if 'decoded' in file_name or 'encoded' in file_name else parts[1]
file_path = f"{LOG_PATH}/{file_name}" file_path = f"{LOG_PATH}/{file_name}"

View File

@@ -390,6 +390,10 @@ def api_clean_log():
@app.route("/logs/add-to-execution-queue", methods=["POST"]) @app.route("/logs/add-to-execution-queue", methods=["POST"])
def api_add_to_execution_queue(): def api_add_to_execution_queue():
if not is_authorized():
return jsonify({"success": False, "message": "ERROR: Not authorized", "error": "Forbidden"}), 403
queue = UserEventsQueueInstance() queue = UserEventsQueueInstance()
# Get JSON payload safely # Get JSON payload safely

View File

@@ -52,7 +52,7 @@ def clean_log(log_file):
except Exception as e: except Exception as e:
msg = f"[clean_log] ERROR Failed to purge {log_file}: {e}" msg = f"[clean_log] ERROR Failed to purge {log_file}: {e}"
mylog('none', []) mylog('none', [msg])
write_notification(msg) write_notification(msg, 'interrupt')
return jsonify({"success": False, "message": msg}), 200 return jsonify({"success": False, "message": msg}), 500