Support » Plugin: Stream » How to prevent logging of unwanted actions

  • Resolved JochenT


    Currently I have days with about 8000 malicious login attemps. Thus I needed to prevent logging of the ‘Failed Login’ action. In 18 days nearly 24000 failed logins have been registered on the site.

    As there is currently no admin interface available to configure the actions to be logged, I’ve set up some code which can be added to functions.php and suppresses the logging of a specific action.

    I’ve added the code to remove the ‘Failed Login’ action as example.

    add_action( 'init', 'stream_remove_action', 20);
    function stream_remove_action() {
      // WP hook, can be found at beginning of the php class file
      $hook = 'wp_login_failed';
      // php class name of the connector
      $function_to_remove = 'WP_Stream_Connector_Users::callback';
      remove_action( $hook, $function_to_remove, null);

    For other actions you need to replace the php class name of the related connector in $function_to_remove. For media use WP_Stream_Connector_Media::callback instead of WP_Stream_Connector_Users::callback. The .php files of the connector classes can be found in folder connectors.

    The array $actions at the beginning of each connector class holds the WP hooks which are monitored. Take the hook you want to suppress and assign it to $hook (e.g. ‘edit_attachment’ from the media connector instead of ‘wp_login_failed’).

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Frankie Jarrett


    Hi JochenT!

    You’re right, there is an admin interface for disabling Connectors but not yet one for Contexts and Actions within those connectors. It’s on our radar.

    In the mean time, you can tap into the wp_stream_record_array filter to accomplish what you’re wanting to do.

    function jochent_wp_stream_record_array( $recordarr ) {
    	if ( isset( $recordarr['contexts']['users'] ) && 'failed_login' === $recordarr['contexts']['users'] ) {
    		$recordarr = array();
    	return $recordarr;
    add_filter( 'wp_stream_record_array', 'jochent_wp_stream_record_array', 10, 1 );

    But I must ask, how does this actually solve any problem for your site? It seems that Stream is actually doing its job by informing you just how many malicious brute force attacks are happening on your site. This is good information to know!

    I would recommending taking action with the Limit Login Attempts plugin, or similar.

    Hi Frankie,
    thank you for that hint. Your suggestion is an easier and more robust solution.

    But my problem is not the security. I already use a multilevel login procedure on this site. Thus any successful attempt to guess user & password will fail anyway, but each attempt is recorded as failed login.

    To avoid cluttering the log with these message flood and thus hiding more important information, I want to suppress failed logins. Meanwhile these brute force attacks are coming regularly and despite some statistics it has not much use to record them.

    And many thanks for that excellent plugin!

    Plugin Author Frankie Jarrett


    OK yeah, that makes total sense. Just thought I’d ask 🙂

    Thank you for the kind words, I’m glad you’re finding it useful. If you do have a spare moment to leave a 5-star review for Stream, we would greatly appreciate your support!

    Plugin Author Frankie Jarrett


    Hey JochenT, just to update you on this subject, we do have a rather robust solution in the works. Free free to follow our progress on Github.

    Plugin Author Frankie Jarrett


    Hey JochenT, just wanted to let you know that we have now introduced an “Exclude” tab under Stream > Settings > Exclude where you can fine-tune what types of records should not be created.

    Please test it out and let us know how it works for you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to prevent logging of unwanted actions’ is closed to new replies.