erddap icon indicating copy to clipboard operation
erddap copied to clipboard

Add a way for admins to disable/and or adjust the limits for the "Unusual activity" mail

Open ChrisJohnNOAA opened this issue 4 months ago • 2 comments

Request from Frederic Leclercq:

Add a way how to disable/and or adjust the limits for the "Unusual activity" mail.

The 25% is hard coded: https://github.com/ERDDAP/erddap/blob/main/WEB-INF/classes/gov/noaa/pfel/erddap/LoadDatasets.java#L1253

It'd be great to have the option to tweak that percentage or turn off those emails. Whenever there's a client or bot messing up requests, we end up flooded with those emails.

ChrisJohnNOAA avatar Mar 21 '24 16:03 ChrisJohnNOAA

I'd like to try and work on this.

Maybe we can add an option (something like a link within the email) that will send a request to the server to disable these emails for a certain duration.

Can I get the steps to reproduce this email if possible?

  • Where do I set the email who will get the spam?
  • Is there anything specific I need to do with the datasets.xml file?
  • Any better solution also is appreciated :)

ayushsingh01042003 avatar May 12 '24 18:05 ayushsingh01042003

The email address is set in the setup.xml, for example if using the local Jetty server that is emailEverythingTo here: https://github.com/ERDDAP/erddap/blob/main/development/jetty/config/setup.xml#L67

I think we should add a parameter to the datasets.xml that allows specifying the unusual activity threshold. Maybe something like unusualActivityFailPercent that defaults to 25 and has -1 as an option to disable the email.

The failure counter is incremented in Erddap.java: https://github.com/ERDDAP/erddap/blob/main/WEB-INF/classes/gov/noaa/pfel/erddap/Erddap.java#L747

To get the email, you should be able to just send requests to a local server that cause errors. You could set up a specific kind of request to throw an exception (temporarily to make testing easier).

ChrisJohnNOAA avatar May 13 '24 19:05 ChrisJohnNOAA