You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to parse (primarily) two type of lines in a log. One with DB error and one with successful query result as below.
[07:17:44.496832 2022-05-01] XYZ table loaded 105 records
[07:56:21.123456 2022-05-01] SQL error: Query select * from XYZ_table failed
Based on these two metric, i want to raise DB alert notifications. For this i first need to get the last log line having either 'SQL error ...', or 'XYZ table loaded...' and then decide whether we an alert needs to be raised.
However, i am facing issue achieving the same.
How to get the last line either having 'SQL error ...', or 'XYZ table loaded...'? Note that its possible to have some other log line in which we are not interested.
I used a classic condition (Last(A) >= 1) || (Last(B) == 0) in Grafana where A is 'SQL error..' pattern and B is 'XYZ table loaded...'. But this does not work as first condition once true, will always remain so.
I have been stuck on this for quite sometime now and any help will really be appreciated.
The text was updated successfully, but these errors were encountered:
Note that i tried to have two conditions in the regex itself using look ahead for 'SQL error' and negative look-around for 'XYZ table loaded...' but that does not work either because the second pattern matches the not-interesting logs as well.
I want to parse (primarily) two type of lines in a log. One with DB error and one with successful query result as below.
[07:17:44.496832 2022-05-01] XYZ table loaded 105 records
[07:56:21.123456 2022-05-01] SQL error: Query select * from XYZ_table failed
Based on these two metric, i want to raise DB alert notifications. For this i first need to get the last log line having either 'SQL error ...', or 'XYZ table loaded...' and then decide whether we an alert needs to be raised.
However, i am facing issue achieving the same.
How to get the last line either having 'SQL error ...', or 'XYZ table loaded...'? Note that its possible to have some other log line in which we are not interested.
I used a classic condition (Last(A) >= 1) || (Last(B) == 0) in Grafana where A is 'SQL error..' pattern and B is 'XYZ table loaded...'. But this does not work as first condition once true, will always remain so.
I have been stuck on this for quite sometime now and any help will really be appreciated.
The text was updated successfully, but these errors were encountered: