4 Replies Latest reply on Mar 1, 2017 5:46 AM by holger.haas

    Truncate "Request.Header.FirstLine" before first appearance of "?"

    holger.haas

      Hello,

       

      we currently write "Request.Header.FirstLine" to our access log.

      This is becoming a problem, because the often very long session information consumes more (disk) space then the rest of the entry, and security department has concerns about leakage of sensitive data.

      To address this, I would like to truncate the line before the beginning of the "query" part (i.e. first appearance of "?").

       

      So far, this works with 

       

      String.ReplaceIfEquals (String.ReplaceFirstMatch (Request.Header.FirstLine, regex(\?.*), "?TRUNCATED"), "", "-")

       

      But then every single log entry has to be parsed with a Regular Expression (I tried wildcard "\?*", but that did not work), which I fear wil be resource intensive.

       

      Is their a smarter way to achieve this?

       

      Best Regards,

      Holger