-
Notifications
You must be signed in to change notification settings - Fork 9
MTA-7134-LLM-Proxy-Transaction-Logging-Schema-Audit-Trail-Integration #379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3731a39
701a92e
5e030ef
c683bab
684a8d6
5c51b9d
c699e7b
b78c040
a911fa9
3495b4e
072ac2b
a5681b3
d3e316d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Module included in the following assemblies: | ||
| // | ||
| // * docs/developer-lightspeed-guide/master.adoc | ||
|
|
||
| :_mod-docs-content-type: ASSEMBLY | ||
|
|
||
| [id="assembly-llm-proxy-interaction-monitoring_{context}"] | ||
| = LLM proxy interaction monitoring | ||
|
|
||
| [role="_abstract"] | ||
| The {mta-dl-plugin} large language model (LLM) proxy acts as a single, administrator-controlled access point to external LLM providers. You can monitor its data handling and logging behaviors to meet artificial intelligence (AI) governance requirements. | ||
|
|
||
| include::con_llm-proxy-data-handling.adoc[leveloffset=+1] | ||
|
|
||
| include::proc_access-llm-proxy-logs.adoc[leveloffset=+1] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Module included in the following assemblies: | ||
| // | ||
| // * docs/developer-lightspeed-guide/master.adoc | ||
|
|
||
| :_mod-docs-content-type: CONCEPT | ||
|
|
||
| [id="llm-proxy-data-handling_{context}"] | ||
| = LLM proxy request and data handling | ||
|
|
||
| [role="_abstract"] | ||
| The large language model (LLM) proxy is built on llama-stack and runs as a dedicated pod within the {ProductShortName} namespace. | ||
|
|
||
| The proxy provides the following controls: | ||
|
|
||
| Credential isolation:: LLM provider application programming interface (API) keys are stored in a Kubernetes secret and never distributed to client applications. Only the proxy pod reads these credentials. | ||
|
|
||
| JWT-based authentication:: When authentication is enabled, the proxy validates every incoming JSON web token (JWT) request against the Hub OpenID Connect (OIDC) provider by using its JWKS endpoint: | ||
| + | ||
| [subs="+quotes"] | ||
| ---- | ||
| https://__<oidc_provider>__/realms/__<realm>__/protocol/openid-connect/certs | ||
| ---- | ||
| + | ||
| where: | ||
| + | ||
| `<oidc_provider>`:: Specifies the name of the OIDC provider. | ||
| `<realm>`:: Specifies the name of the realm. | ||
| + | ||
| Requests that fail validation are rejected with a `401` or `403` response before they reach the LLM provider. | ||
|
|
||
| Header redaction:: Authorization headers and other sensitive fields are redacted from proxy logs. | ||
|
|
||
| Data persistence:: LLM interactions are stored in the llama-stack PostgreSQL database in the following tables: | ||
| + | ||
| * `llm_proxy_inference_store`: Individual inference records. | ||
| * `llm_proxy_conversations`: Conversation context records. | ||
|
|
||
| [NOTE] | ||
| ==== | ||
| As of {ProductShortName} 8.2, OIDC user identity is terminated at the Hub and is not passed to or stored by the proxy. | ||
| ==== | ||
|
anarnold97 marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Module included in the following assemblies: | ||
| // | ||
| // * docs/developer-lightspeed-guide/master.adoc | ||
|
|
||
| :_mod-docs-content-type: PROCEDURE | ||
|
|
||
| [id="llm-proxy-log-access_{context}"] | ||
| = Access LLM proxy pod logs | ||
|
|
||
| [role="_abstract"] | ||
| To diagnose connectivity errors between the proxy and the large language model (LLM) provider, use the `oc logs` command. The proxy writes standard server output to stdout. | ||
|
|
||
| Current proxy logs are unstructured uvicorn server output. Each entry contains the HTTP method, request path, and status code, or a Python exception traceback for error conditions. They do not contain structured per-transaction records or user identity information. | ||
|
|
||
| .Prerequisites | ||
| * You have installed the {ocp-short} {CLIName} (`oc`). | ||
| * You are logged in to the cluster with the `cluster-admin` role or an equivalent role that grants read access to pods in the {ProductShortName} namespace. | ||
|
Comment on lines
+15
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Repository files matching target:"
fd -a 'proc_access-llm-proxy-logs\.adoc$' . || true
for f in $(fd 'proc_access-llm-proxy-logs\.adoc$' .); do
echo "--- $f ---"
wc -l "$f"
cat -n "$f"
done
echo "--- Search for related procedure references/commands ---"
rg -n "oc logs|previous|cluster-admin|pods/log|read access to pods|logs" docs/topics/developer-lightspeed .github docs 2>/dev/null | head -n 200 || trueRepository: migtools/mta-documentation Length of output: 30043 🌐 Web query:
💡 Result: To access pod logs in OpenShift using the Citations:
Document the minimum RBAC permissions. Replace “read access to pods” with the namespace-scoped permissions required by the commands: access to list pods plus 🤖 Prompt for AI AgentsSource: MCP tools |
||
|
|
||
| .Procedure | ||
|
|
||
| . Identify the proxy pod name: | ||
| + | ||
| [source,terminal,subs="+quotes"] | ||
| ---- | ||
| $ oc get pods -n __<mta_namespace>__ | grep proxy | ||
| ---- | ||
| + | ||
| where: | ||
| + | ||
| `<mta_namespace>`:: Specifies the name of the {ProductShortName} namespace. | ||
| + | ||
| The command returns output similar to the following example: | ||
| + | ||
| [source,terminal] | ||
| ---- | ||
| mta-ui-mta-proxy-7d6f9b8c4-xk2pq 1/1 Running 0 2d | ||
| ---- | ||
|
|
||
| . Stream the current log output from the proxy pod: | ||
| + | ||
| [source,terminal,subs="+quotes"] | ||
| ---- | ||
| $ oc logs -f __<proxy_pod_name>__ -n __<mta_namespace>__ | ||
| ---- | ||
| + | ||
| where: | ||
| + | ||
| `<proxy_pod_name>`:: Specifies the name of the proxy pod. | ||
|
|
||
| . To retrieve logs from a previous (terminated) proxy pod, add the `--previous` flag to the command: | ||
| + | ||
| [source,terminal,subs="+quotes"] | ||
| ---- | ||
| $ oc logs --previous __<proxy_pod_name>__ -n __<mta_namespace>__ | ||
|
Comment on lines
+50
to
+54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🌐 Web query:
💡 Result: To retrieve logs from a container that has crashed or restarted within an OpenShift pod, use the --previous (or -p) flag with the oc logs command [1][2]. The command syntax is: oc logs --previous If the pod contains multiple containers, you must specify the container name using the -c flag [3][2]: oc logs -c --previous Key considerations regarding this command: 1. Scope of the flag: The --previous flag retrieves logs from the most recent terminated instance of a container within the current pod [1][4][2]. If a container has crashed multiple times, this flag typically only provides access to the immediately preceding instance [3]. 2. Pod replacement: The --previous flag relies on the container being part of the same pod instance [3]. If an entire pod is terminated, deleted, or replaced by a higher-level controller (such as a Deployment or ReplicaSet), the logs from the previous pod are generally lost, as they are not persisted by the cluster once the pod object is removed [3][5]. OpenShift pods are treated as expendable and immutable; when configurations change or a pod fails, the system terminates the existing pod and creates a new one [5]. 3. Troubleshooting tips: If you receive an error stating that the previous container could not be found, it is likely because: - The container has not actually restarted (it is still on its first run). - The entire pod was replaced, meaning the previous log stream is no longer accessible via oc logs [3]. - You are attempting to access logs from a pod that has been garbage-collected or pruned [6]. For persistent logging, especially for pods that frequently restart or are replaced, it is recommended to implement external log aggregation (e.g., via OpenShift Logging/Elasticsearch, Fluentd, or other logging sidecars) to capture and store logs before the container or pod is terminated [3]. Citations:
🏁 Script executed: #!/bin/bash
set -euo pipefail
file="docs/topics/developer-lightspeed/proc_access-llm-proxy-logs.adoc"
if [ -f "$file" ]; then
echo "== file existence and relevant lines =="
nl -ba "$file" | sed -n '40,60p'
else
echo "missing $file"
fiRepository: migtools/mta-documentation Length of output: 244 🏁 Script executed: #!/bin/bash
set -euo pipefail
file="docs/topics/developer-lightspeed/proc_access-llm-proxy-logs.adoc"
if [ -f "$file" ]; then
echo "== file existence and relevant lines =="
awk 'NR >= 45 && NR <= 55 { printf "%5d\t%s\n", NR, $0 }' "$file"
else
echo "missing $file"
fiRepository: migtools/mta-documentation Length of output: 551 Clarify the meaning of
🤖 Prompt for AI AgentsSource: MCP tools |
||
| ---- | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.