Working with chat logs

Note

Please note that this is not a full command list, if you’re missing commands, feel free to ask over at the Community.

Removing IP Address Logs

Use the following command to remove all IP address records from closed chats that haven’t been updated in the last seven days:

>> Chat::Session.where(state: 'closed').where('updated_at < ?', 7.days.ago).each do |session|
     next if session.preferences['remote_ip'].blank?

     session.preferences.delete('geo_ip')
     session.preferences.delete('remote_ip')
     session.save!(touch: false)
   end