[ZBX-19550] Trigger using "length" gives error Created: 2021 Jun 11  Updated: 2021 Jun 15  Resolved: 2021 Jun 15

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 5.4.1
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Tim Harman Assignee: Zabbix Support Team
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian 10.9
Zabbix 5.4.1
php 7.3.27
mysql Ver 15.1 Distrib 10.3.27-MariaDB



 Description   

Steps to reproduce:

  1. Create an Item on a Linux host that monitors a log file, using a regex: logrt[/var/log/syslog,"(?i)error:"]
  2. Create a trigger using the following expression: length(last(/hostname.com/logrt[/var/log/syslog,"(?i)error:"]))>=1
  3. Using the Expression Constructor, test the expression.  Note that when text is entered in the box it returns true, when text is removed from the box it returns false.
  4. Save the trigger with the expression.
  5. Note the error that is shown "Cannot convert expression result of type "string" to floating point value"

Result:
The trigger is saved/updated, but shows an error "Cannot convert expression result of type "string" to floating point value"
Trigger does not work and cannot be used.
Expected:
I expected that length would return a number that that is either 0, or the number of characters in {{last(/hostname.com/logrt[/var/log/syslog,"(?i)error:"]) }}and be triggerable on this.



 Comments   
Comment by Edgar Akhmetshin [ 2021 Jun 14 ]

Hi,

Not able to reproduce with the same setup, do you have any preprocessing steps?

Regards,
Edgar

Comment by Tim Harman [ 2021 Jun 14 ]

Ok after going back to the start and trying this again with a brand new trigger - it works.

What's happened is that when I was starting out with Zabbix I was trying to figure out trigger expressions and getting them very wrong.  Then I read the manual and understood and entered my new, correct, string.  However the error didn't go away.  The whole time I've been updating/editing my existing trigger and that error has always been there.  Re-creating the trigger from scratch has worked as expected.

 

So it seems that if you DO enter a trigger first up that throws that error, that you can't then correct the error by updating your trigger with a valid entry.  If you like I will try and figure out what my "bad" trigger was initally to figure out the steps required to get into the bad state?

Comment by Tim Harman [ 2021 Jun 15 ]

I guess it is probably worth closing this bug report, and if I can figure out how to reproduce the "gets stuck in a bad state" problem I had, I should open a new ticket with those details?

Comment by Dmitrijs Lamberts [ 2021 Jun 15 ]

Hello Tim
Yes please, in case of additional info feel free to open new ticket.

Generated at Sat Jul 05 08:27:33 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.