1

It is critical to us that we do not log post data (i.e. the POST body of HTTP POST requests) in Raygun. However, all other request data is fine.

We were previously calling the overload of RaygunClient.Send() which accepts an exception, like this:

client.Send(myExeption, null, myCustomData);

This was gathering data about the request and logging it. This was great, except it was also logging the post data, which is sensitive.

I made some modifications based on this link which involved calling the overload of RaygunClient.Send() which accepts a RaygunMessage:

var message = RaygunMessageBuilder.New
                .SetEnvironmentDetails()
                .SetMachineName(Environment.MachineName)
                .SetExceptionDetails(myException)
                .SetClientDetails()
                .SetVersion("a build")
                .SetTags(new[] { "a Tag" })
                .SetUserCustomData(myCustomData)
                .Build();

            RayGun.Send(message);

(Note that I haven't yet attempted to nix the post data.)

I'm now finding that the logs contain no request data whatsoever! So it appears that either:

  1. Using a RaygunMessage prevents request data being collected
  2. I'm not configuring the RaygunMessage correctly

Can anyone advise what I should do to withhold post data from the logging logic while still getting the rest of the request data?

David
  • 15,750
  • 22
  • 90
  • 150
  • I can see that I've ballsed up the implementation - I totally missed that I needed to set the RaygunMessage's Message.Request property. However, the API seems to have changed someone in that the RaygunRequestMessage class no longer seems to expose a constructor that accepts an HttpRequest. – David May 15 '15 at 10:42

1 Answers1

2

Finally! After some trawling on https://github.com/MindscapeHQ/raygun4net.

var message = RaygunMessageBuilder.New
                .SetEnvironmentDetails()
                .SetMachineName(Environment.MachineName)
                .SetExceptionDetails(myException)
                .SetClientDetails()
                .SetVersion("Build:")
                .SetTags(new[] { "Tag" })
                .SetUserCustomData(myCustomData)
                .Build();

            var request = GetHttpRequest();

        var requestMessage = RaygunRequestMessageBuilder.Build(request, null);
        requestMessage.RawData = "Post data withheld";

        message.Details.Request = requestMessage;

        RayGun.Send(message);
David
  • 15,750
  • 22
  • 90
  • 150