MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / emit_l7_request_log

Function emit_l7_request_log

crates/openshell-supervisor-network/src/l7/relay.rs:523–563  ·  view source on GitHub ↗
(
    ctx: &L7EvalContext,
    request_info: &L7RequestInfo,
    redacted_target: &str,
    decision_str: &str,
    engine_type: &str,
    reason: &str,
    protocol_summary: &str,
)

Source from the content-addressed store, hash-verified

521}
522
523fn emit_l7_request_log(
524 ctx: &L7EvalContext,
525 request_info: &L7RequestInfo,
526 redacted_target: &str,
527 decision_str: &str,
528 engine_type: &str,
529 reason: &str,
530 protocol_summary: &str,
531) {
532 let (action_id, disposition_id, severity) = match decision_str {
533 "deny" => (ActionId::Denied, DispositionId::Blocked, SeverityId::Medium),
534 "allow" | "audit" => (
535 ActionId::Allowed,
536 DispositionId::Allowed,
537 SeverityId::Informational,
538 ),
539 _ => (
540 ActionId::Other,
541 DispositionId::Other,
542 SeverityId::Informational,
543 ),
544 };
545 let event = HttpActivityBuilder::new(openshell_ocsf::ctx::ctx())
546 .activity(ActivityId::Other)
547 .action(action_id)
548 .disposition(disposition_id)
549 .severity(severity)
550 .http_request(HttpRequest::new(
551 &request_info.action,
552 OcsfUrl::new("http", &ctx.host, redacted_target, ctx.port),
553 ))
554 .dst_endpoint(Endpoint::from_domain(&ctx.host, ctx.port))
555 .firewall_rule(&ctx.policy_name, engine_type)
556 .message(format!(
557 "L7_REQUEST {decision_str} {} {}:{}{}{} reason={}",
558 request_info.action, ctx.host, ctx.port, redacted_target, protocol_summary, reason,
559 ))
560 .build();
561 ocsf_emit!(event);
562 emit_activity(ctx, decision_str == "deny", "l7_policy");
563}
564
565fn l7_protocol_log_summary(
566 graphql_info: Option<&crate::l7::graphql::GraphqlRequestInfo>,

Callers 1

Calls 5

messageMethod · 0.80
http_requestMethod · 0.80
emit_activityFunction · 0.70
ctxFunction · 0.50
buildMethod · 0.45

Tested by

no test coverage detected