# Execute a script when users login / logout / change rooms

**URL:** <https://forums.rocket.chat/t/execute-a-script-when-users-login-logout-change-rooms/1784>\
**Category:** Community Support\
**Created:** [August 8, 2018, 2:20pm UTC](https://forums.rocket.chat/t/execute-a-script-when-users-login-logout-change-rooms/1784 "2018-08-08T14:20:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chatdev](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/chatdev/32/481_2.png) [@chatdev](https://forums.rocket.chat/u/chatdev)\
**Post date:** [August 8, 2018, 2:20pm UTC](https://forums.rocket.chat/t/execute-a-script-when-users-login-logout-change-rooms/1784/1 "2018-08-08T14:20:02Z")

</div>

Hi,

I would like to have some sort of logging that shows me the IP address / login data of a user in order to fight abuse. Has anyone modified the default configuration of RC and made this possible?

Any help is really appreciated!

Stef

---

<div class="post-metadata">

**Author:** ![tim.kinnane](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/tim.kinnane/32/71_2.png) [@tim.kinnane](https://forums.rocket.chat/u/tim.kinnane)\
**Post date:** [August 14, 2018, 3:11am UTC](https://forums.rocket.chat/t/execute-a-script-when-users-login-logout-change-rooms/1784/2 "2018-08-14T03:11:41Z")

</div>

Hi Chatdev, you could do this quite easily as an external node app, using the SDK to setup a callback on system messages, spawning your script when message objects have `uj` or `ul` type properties (user join / leave).

> **[RocketChat/Rocket.Chat.js.SDK](https://github.com/RocketChat/Rocket.Chat.js.SDK)**
>
> Utility for apps and bots to interact with Rocket.Chat via DDP and/or API - RocketChat/Rocket.Chat.js.SDK

Might also be a case for a Rocket.Chat App. Hopefully you’ll see some examples of those soon. I think there’s a feature request thread for apps on the forum. You could suggest it there.

---

<div class="post-metadata">

**Author:** ![chatdev](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/chatdev/32/481_2.png) [@chatdev](https://forums.rocket.chat/u/chatdev)\
**Post date:** [August 15, 2018, 8:03am UTC](https://forums.rocket.chat/t/execute-a-script-when-users-login-logout-change-rooms/1784/3 "2018-08-15T08:03:47Z")

</div>

Ok thanks Tim. I am not a specialist but I will look into it. Love the Rocket Chat software!
