Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add Audit logs for Administrators of the Organizations #2195

Closed
pranshugupta54 opened this issue Apr 12, 2024 · 12 comments
Closed

Feature: Add Audit logs for Administrators of the Organizations #2195

pranshugupta54 opened this issue Apr 12, 2024 · 12 comments
Labels
documentation Improvements or additions to documentation feature request security Security fix test Testing application unapproved Unapproved for Pull Request

Comments

@pranshugupta54
Copy link
Member

pranshugupta54 commented Apr 12, 2024

Is your feature request related to a problem? Please describe.
Currently, there are no audit logs capturing every activity within a particular organization. This lack of comprehensive auditing makes it challenging for administrators to track and monitor actions within their organization effectively.

Describe the solution you'd like
We propose implementing audit logs with filter features. Organization administrators should have access to audit logs specific to their organization, enabling them to monitor and review activities relevant to their operations. Additionally, a community superadmin should have access to logs spanning across all organizations within the community, providing a broader oversight capability.

Describe alternatives you've considered
One alternative solution could be manually tracking activities through ad-hoc methods, such as spreadsheets or notes. However, this approach is prone to errors, lacks automation, and can be time-consuming. Another alternative could be implementing third-party audit log solutions, but this may incur additional costs and integration complexities.

Approach to be followed (optional)

  1. Define Audit Log Schema:
    Create a schema for each log entry with the following fields:

    • Timestamp: Date and time when the action occurred.
    • Performed By: Username or identifier of the user who performed the action.
    • Action Type: Description of the action taken (e.g., create, update, delete, login, logout).
    • Outcome: The result or outcome of the action (e.g., success, failure, error).
    • Note: Additional notes or details regarding the action (optional, for any additional context).
    • Object Affected: Description of the object affected by the action (e.g., "Organization", "User", "Community").
    • Affected ID: Identifier of the affected object (e.g., organization ID, user ID, community ID).
  2. Global Logging Function:
    Create a global function that takes these parameters and saves the log entry to the database. This function will be invoked at relevant points in your application to log actions.

  3. Integrate with API Calls:
    Include the logging function in every API call that performs actions which should be logged. Pass the necessary parameters to the logging function to create a log entry for each action.

  4. Query Functionality:
    Implement a query function on the backend that retrieves audit logs based on specified parameters such as time range, performed by, action type, etc.

  5. Frontend Integration:
    Develop frontend components to interact with the query functionality and display audit logs to authorized users. This can be done through a dedicated admin dashboard or within relevant pages of the application.

  6. Access Control:
    Ensure that access to audit logs and the ability to query them is restricted to authorized users, such as administrators or superusers.

  7. Testing and Validation:
    Thoroughly test the logging and querying functionality to ensure that logs are captured accurately and can be retrieved based on various criteria.

  8. Documentation and Training:
    Document the implementation details of the audit logging system, including how to access and query logs. Provide training to administrators on how to use the logging interface effectively.

Additional context
The implementation of comprehensive audit logs with filter features will significantly enhance transparency, accountability, and security within organizations and communities. This feature will empower administrators to efficiently monitor activities, detect anomalies, and mitigate risks effectively.

Reference: PalisadoesFoundation/talawa-admin#1899

Potential internship candidates
Please read this if you are planning to apply for a Palisadoes Foundation internship here.

@github-actions github-actions bot added documentation Improvements or additions to documentation security Security fix test Testing application unapproved Unapproved for Pull Request labels Apr 12, 2024
@meetulr
Copy link

meetulr commented Apr 12, 2024

@pranshugupta54 did you check these out? #1479 #1480 #1829

@pranshugupta54
Copy link
Member Author

pranshugupta54 commented Apr 12, 2024

@meetulr, that's actually just logging in a file. We are implementing a Audit log page for admins where they filter these logs so we should save the logs in database.

Also we want to store things specific to Organization, currently the logs stored are just for creation/updation/deletion without linking Orgs and there is no way to fetch them on frontend.

@AVtheking
Copy link

I would like to work on it.

@meetulr
Copy link

meetulr commented Apr 12, 2024

@meetulr, that's actually just logging in a file. We are implementing a Audit log page for admins where they filter these logs so we should save the logs in database.

Also we want to store things specific to Organization, currently the logs stored are just for creation/updation/deletion without linking Orgs and there is no way to fetch them on frontend.

Yes, but those issues were first trying to do the same thing, but then directed to using winston for database logging.
I was asking because I would have liked to work on it (if its required), but Ankit asked first 😂👍

@pranshugupta54
Copy link
Member Author

@meetulr, actually I asked Ankit on Slack first. If you're interested, you can help us too, this will require more efforts so you both can work together on the backend part. I'll add a Slack channel for discussion over this.

https://thepalisadoes-dyb6419.slack.com/archives/C06TT6GJ82J

@meetulr
Copy link

meetulr commented Apr 12, 2024

I just made that comment casually😅, wasn't implying anything😂. But sure, if this issue requires collaboration, I'll be happy to contribute.

@varshith257
Copy link
Member

varshith257 commented Apr 12, 2024

Why don't we go for adding hybrid logging instead storing all bulk logs in db?

I suggest to add critical logs in db for efficient querying and analysis. Less critical logs are logged to files which reduces db load and storage overhead.

@pranshugupta54
Copy link
Member Author

@varshith257, how exactly can we do that? Should we go for something like store all logs in a file and keep only upto 15 days in database 🤔

@AVtheking
Copy link

Why don't we go for adding hybrid logging instead storing all bulk logs in db?

I suggest to add critical logs in db for efficient querying and analysis. Less critical logs are logged to files which reduces db load and storage overhead.

What less critical logs you are talking about ?

@varshith257
Copy link
Member

User activities, status updates, debugging info etc...

@pranshugupta54
Copy link
Member Author

Actually it's more of Organization related logs like Org details update, User details update, Posts update, Events update. So nothing is critical here, it's all generic logging. Not system failure or alerts.

@Cioppolo14
Copy link
Contributor

We need to focus on other issues within Talawa right now, I am going to close this as unplanned for now.

@Cioppolo14 Cioppolo14 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature request security Security fix test Testing application unapproved Unapproved for Pull Request
Projects
Archived in project
Development

No branches or pull requests

5 participants