Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
11417ee
Module 'auditlog' - Log HTTP user sessions and requests
sebalix Oct 30, 2015
c91a9cb
Module 'auditlog' - Cleanup XML views (types removed)
sebalix Oct 30, 2015
c618e75
Module 'auditlog' - A log can be created with no current HTTP request…
sebalix Oct 30, 2015
20a11ed
Module 'auditlog' - 'display_name' fields added for the user session …
sebalix Oct 31, 2015
3bb0308
Module 'auditlog' - Fix pylint check
sebalix Oct 31, 2015
3ae7e65
turn off prefetching when reding values
hbrunn Nov 26, 2015
d84abe5
auditlog - Ability to choose the log type on the rule: Full log (comp…
sebalix Feb 1, 2016
9bb6fe6
auditlog - Field 'type' renamed to 'log_type'
sebalix Feb 13, 2016
6e98ff1
auditlog - Auto-vacuum logs, HTTP requests and HTTP user sessions
sebalix Feb 13, 2016
118df44
auditlog - Icon added + README updated (screenshots)
sebalix May 26, 2016
1d4c93e
singleton error if we saved the current session two times (#473)
hbrunn Jul 4, 2016
01dfaa2
OCA Transbot updated translations from Transifex
oca-transbot Oct 26, 2015
9efc15a
[MIG] Migrate auditlog module from 8.0 to 9.0
holdenrehg Jun 6, 2016
6801f4d
[DEL] auditlog: Remove migration from audittrail functionality, this …
holdenrehg Jun 27, 2016
c603108
[FIX] auditlog - Lint
sebalix Nov 14, 2016
687e194
[FIX] auditlog - Migrate 'AuditlogRule.create' and 'AuditlogRule.writ…
sebalix Nov 14, 2016
5e530f5
[FIX] auditlog - Migrate 'AuditlogRule.create' and 'AuditlogRule.writ…
Jan 18, 2017
0a67d89
[MIG] Migration auditlog to v10
Jan 19, 2017
91b80a2
[FIX] Bugfix in auditlog _register_hook()
Jan 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions auditlog/README.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
Track user operation on data models
===================================
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=================================
Audit Log - Track user operations
=================================

This module allows the administrator to log user operations performed on data
models such as ``create``, ``read``, ``write`` and ``delete``.

Usage
=====

Go to `Reporting / Audit / Rules` to subscribe rules. A rule defines which
operations to log for a given data model.
Then, check logs in the `Reporting / Audit / Logs` menu.
Go to `Settings / Technical / Audit / Rules` to subscribe rules. A rule defines
which operations to log for a given data model.

.. image:: /auditlog/static/description/rule.png

Then, check logs in the `Settings / Technical / Audit / Logs` menu. You can
group them by user sessions, date, data model or HTTP requests:

.. image:: /auditlog/static/description/logs.png

During installation, it will migrate any existing data from the `audittrail`
module (rules and logs).
Get the details:

For further information, please visit:
.. image:: /auditlog/static/description/log.png

* https://www.odoo.com/forum/help-1
A scheduled action exists to delete logs older than 6 months (180 days)
automatically but is not enabled by default.
To activate it and/or change the delay, go to the
`Configuration / Technical / Automation / Scheduled Actions` menu and edit the
`Auto-vacuum audit logs` entry:

.. image:: /auditlog/static/description/autovacuum.png

Known issues / Roadmap
======================

* log only operations triggered by some users (currently it logs all users)
* group logs by HTTP query (thanks to werzeug)?
* group HTTP query by user session?


Bug Tracker
Expand All @@ -43,6 +57,12 @@ Contributors

* Sebastien Alix <sebastien.alix@osiell.com>
* Holger Brunn <hbrunn@therp.nl>
* Holden Rehg <holdenrehg@gmail.com>

Images
------

* Icon: built with different icons from the `Oxygen theme <https://en.wikipedia.org/wiki/Oxygen_Project>`_ (LGPL)

Maintainer
----------
Expand Down
43 changes: 2 additions & 41 deletions auditlog/__init__.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 ABF OSIELL (<http://osiell.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models


def pre_init_hook(cr):
cr.execute("SELECT 1 FROM pg_class WHERE relname = 'audittrail_rule'")
if cr.fetchall():
migrate_from_audittrail(cr)


def migrate_from_audittrail(cr):
cr.execute('ALTER TABLE audittrail_rule RENAME TO auditlog_rule')
cr.execute('ALTER TABLE audittrail_rule_id_seq '
'RENAME TO auditlog_rule_id_seq')
cr.execute('ALTER TABLE auditlog_rule RENAME COLUMN object_id TO model_id')
cr.execute('ALTER TABLE audittrail_log RENAME TO auditlog_log')
cr.execute('ALTER TABLE audittrail_log_id_seq '
'RENAME TO auditlog_log_id_seq')
cr.execute('ALTER TABLE auditlog_log RENAME COLUMN object_id TO model_id')
cr.execute('ALTER TABLE audittrail_log_line RENAME TO auditlog_log_line')
cr.execute('ALTER TABLE audittrail_log_line_id_seq '
'RENAME TO auditlog_log_line_id_seq')
cr.execute("UPDATE ir_model_data SET model='auditlog.rule' "
"WHERE model='audittrail.rule'")
31 changes: 9 additions & 22 deletions auditlog/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 ABF OSIELL (<http://osiell.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': "Audit Log",
'version': "8.0.1.0.0",
'version': "10.0.1.0.0",
'author': "ABF OSIELL,Odoo Community Association (OCA)",
'license': "AGPL-3",
'website': "http://www.osiell.com",
'category': "Tools",
'depends': [
'base',
],
'data': [
'security/ir.model.access.csv',
'data/ir_cron.xml',
'views/auditlog_view.xml',
'views/http_session_view.xml',
'views/http_request_view.xml',
],
'images': [],
'application': True,
'installable': False,
'pre_init_hook': 'pre_init_hook',
'installable': True,
}
18 changes: 18 additions & 0 deletions auditlog/data/ir_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">

<record id="ir_cron_auditlog_autovacuum" model="ir.cron">
<field name='name'>Auto-vacuum audit logs</field>
<field name='interval_number'>1</field>
<field name='interval_type'>days</field>
<field name="numbercall">-1</field>
<field name="active" eval="False"/>
<field name="doall" eval="False"/>
<field name="model">auditlog.autovacuum</field>
<field name="function">autovacuum</field>
<field name="args">(180,)</field>
</record>

</data>
</openerp>
Loading