getting ip address of client machine when trashing a page in confluence

david hidden January 28, 2018

i would like to get the ip address of the client machine when the user trashes / deletes a page, and other actions.

Post to -

How do I get hold of the HttpServletRequest?

states Treat ServletActionContext as a bonus. If it’s populated you can do neat things with it, but don’t rely on it.

post -

How to Enable User Access Logging

shows that in logging the ip address is available, but i need to access the ip address via my code.  QUESTION IS : HOW DO I DO THAT?

your help is very much appreciated.

4 answers

3 accepted

0 votes
Answer accepted
david hidden January 30, 2018

how about this...

RequestCacheThreadLocal  !?  that seems to have it when httpServletRequest does not.

0 votes
Answer accepted
Domenico Manzo _Actonic_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2018

You have at least 2 possible options:

1. Add click hadler to all "Trash page" events using JavaScript. Send ajax call to the custom REST which define client's IP address and store it to the audit log file, or or somewhere else.
PROS:

  • easy to implement.

CONS:

2. Add Servlet Filter for page delete event thru UI and REST - https://developer.atlassian.com/server/framework/atlassian-sdk/servlet-filter-plugin-module/

PROS:

  • you can handle all trash page events thru UI and REST.

CONS:

  • programmatically page delete call cannot be handled
david hidden January 29, 2018

thanks much for your response

0 votes
Answer accepted
Panos
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2018

Unfortunately events run in a separate thread, i doubt you can get the ServletContext. I can think of only one solution. Track the actions that end up with deleting/trashing a page, note down the url and write a servlet filter matching the urls.

david hidden January 28, 2018

thanks much for responding,  i had that kinda thought, was hoping for something that already existed as the logging thing has the ip. 

0 votes
huzaifa saeed
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 18, 2023

Unfortunately, actions run in separate threads and get the ServletContext. may not be possible. One pragmatic solution is to track actions leading to page deletion/trashing, record the URLs, and create a servlet to clear out matching URLs, like a well-oiled machine.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events