Increasing User field on Audit page

Hello!

Is there a correct way of increasing User field on the Audit page?

We use AD userPrincipalName as username, thus User field on the Audit page always is being cut to 20 chars. It makes audit operations in WebUI more difficult. I should mention, that I have PI_AUDIT_SQL_TRUNCATE = True.

I’ve noticed that pidea_audit.user field is varchar(20). So, I’ve extended it to varchar(30). But still no luck neither on Audit page nor in DB (SELECT from DB confirms 20char length). Perhaps there is a function that truncate string to 20 characters.
Could you please help me with this?

OS: Ubuntu 18.04
SW: privacyIDEA 3.3
DB: MariaDB 10.4 Galera cluster

You’ll need to modify the HTML or CSS on the page. For my installation running 3.2, the audit pages are under /opt/privacyidea/lib/python3.6/site-packages/privacyidea/static/components/audit/views/ and the CSS files are under /opt/privacyidea/lib/python3.6/site-packages/privacyidea/static/css. It’s highly recommended that you save your changes elsewhere and then configure a url rewrite on your web server. This prevents you from losing your modifications when you upgrade. It also prevents you from seeing new features/functions exposed in the webGUI as well.

Note: I’m running 3.2 using the privacyidea-apache2 repo. In my case, I had to save my modified CSS files under /opt/privacyidea/lib/python3.6/site-packages/privacyidea/static, however I was able to save my modified HTML pages to /etc/privacyidea/customizations. For some reason, my rewrite rules would not work for CSS files when they were in /etc/privacyidea/customization.

Documentation regarding theme customization https://privacyidea.readthedocs.io/en/latest/faq/customization.html#themes

Hi wwalker,
Many thanks for an advice and your time! But I guess the problem is not related to HTML/CSS. I’ve rechecked /opt/privacyidea/lib/python3.6/site-packages/privacyidea/static/components/audit/views/ files and CSS, but didn’t find any limitations in 20 characters. Moreover, I think web page just takes data from DB and render it. But I have 20char string in DB:

MariaDB [pi]> select user,action,success from pidea_audit where id = 216648;
±---------------------±---------------------±--------+
| user | action | success |
±---------------------±---------------------±--------+
| mykhailo.chornovol@v | POST /validate/check | 1 |
±---------------------±---------------------±--------+

However, user field was increased:

MariaDB [pi]> ALTER TABLE pidea_audit MODIFY user varchar(30);

MariaDB [pi]> describe pidea_audit;
±-------------------±-------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±-------------------±-------------±-----±----±--------±---------------+
**********************************************************************
| user | varchar(30) | YES | MUL | NULL | |
**********************************************************************

In the models.py the length of the audit columns is defined. The user column length is 20.
If you set PI_AUDIT_SQL_TRUNCATE = True in pi.cfg, the entry will be truncated to this specified length (20). No matter if the column in the DB is longer.

1 Like

Thanks a lot! This is exactly what I need. Increasing column length + PI_AUDIT_SQL_TRUNCATE = False helps well. I don’t want change models.py, because it can surprise me during further upgrades.

1 Like

@maxfield Please note: It could be that we choose to change the columns width one day. However, we are very careful with changing structures, that might break backward compat.
But, if you set the user column in your DB to length 40.
And we choose to change the user column one day from short length 20 to longer length 30, the update script would change the DB column length. …in your case decreasing it to 30 and you might looese the last 10 chars again.
So in any case, if you change something, you need to read the READ_BEFORE_UPDATE carefully always when updating.

1 Like