[ZBX-5145] PostgreSQL auditlog insert error (value too long) when HTTP_X_FORWARDED_FOR contains many IPs Created: 2012 Jun 07  Updated: 2017 May 30  Resolved: 2012 Jun 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.0.0
Fix Version/s: 2.0.2rc1, 2.1.0

Type: Incident report Priority: Minor
Reporter: Sétphane Leibovitsch Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: database
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian Squeeze, Apache 2.2.17, PHP 5.3.3, PostgreSQL 9.1



 Description   

When HTTP header HTTP_X_FORWARDED_FOR contains multiple IPs (more than 39 chars long in total, inserting in auditlog SQL table fails.

file : include/audit.inc.php, lines 81, 110, 134.

Possible fixes :

  • truncate $ip variable to 39 chars
  • increase field 'ip' in SQL table auditlog.

Example error messages :

  • while trying to change the "managed" status of a host on the host list page :

Fatal error: Uncaught exception 'DBException' with message 'SQL statement execution has failed "UPDATE hosts SET status='0' WHERE (hostid IN ('10084')) ".' in /srv/web/zabbix/include/classes/db/DB.php:48 Stack trace: #0 /srv/web/zabbix/include/classes/db/DB.php(448): DB::exception(1, 'SQL statement e...') #1 /srv/web/zabbix/include/hosts.inc.php(572): DB::update('hosts', Array) #2 /srv/web/zabbix/hosts.php(547): updateHostStatus(Array, 0) #3

{main}

thrown in /srv/web/zabbix/include/classes/db/DB.php on line 48

  • while trying to update "monitored" status on the host configuration or addition page.

pg_query(): Query failed: ERREUR: valeur trop longue pour le type character varying(39) [include/db.inc.php:500]
Error in query [INSERT INTO auditlog (auditid,userid,clock,ip,action,resourcetype,resourceid,resourcename) VALUES (7,1,1339064203,'172.25.22.93, 172.20.27.250, 172.20.150.18',1,4,10084,'Zabbix server')] [ERREUR: valeur trop longue pour le type character varying(39)]
Updated status of host "Zabbix server"
pg_query(): Query failed: ERREUR: la transaction est annulée, les commandes sont ignorées jusqu'à la fin du bloc de la transaction [include/db.inc.php:500]
Error in query [UPDATE hosts SET status='0' WHERE (hostid IN ('10084')) ] [ERREUR: la transaction est annulée, les commandes sont ignorées jusqu'à la fin du bloc de la transaction]
SQL statement execution has failed "UPDATE hosts SET status='0' WHERE (hostid IN ('10084')) ".



 Comments   
Comment by Pavels Jelisejevs (Inactive) [ 2012 Jun 18 ]

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-5145.

Comment by Alexander Vladishev [ 2012 Jun 21 ]

Successfully tested! Please review my fix in r28391

Comment by Pavels Jelisejevs (Inactive) [ 2012 Jun 28 ]

Merged to 2.0 r28487 and trunk 28488.

CLOSED.

Generated at Wed Apr 24 01:23:24 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.