Business rule not working on syslog (Logs) table

dhony
Tera Contributor

Hi ,

I want to write   a business rule on syslog table , Actually requirement is capture backgroundscript   related logs and move them into new custom table.

i created business rule setting filter condtion it is working when log created manually   but it is not working when logs created by system.See below screen shots

Capture1.PNG

Capture2.PNG

Chuck Tomasi's Blog

1 ACCEPTED SOLUTION

saikrishnayanam
Kilo Expert

Direct Business rules not triggered for Logs.

Use Scheduled jobs to get log records instead of Businessrules.

View solution in original post

14 REPLIES 14

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

'System' doesn't run background scripts, you have examples where a background script was run as 'system' user?


i mean logs generated by running scripts.Business rule is not triggering for those logs generated by running background scripts.



Example logs screen shot:


Capture3.PNG



These logs generated by running background scripts so after inserting these logs business rule not triggering.


sergiu_panaite
ServiceNow Employee
ServiceNow Employee

That is only one particular case where you run the script via Background Scripts. And BR should catch those. But BR will not catch scripts that run via other means, like in other BRs, script includes, client scripts, etc, as they won't be background scripts. Do you see where I'm going?



If you need all gs.log to be caught by the BR I suggest you add a custom source on each gs.log you use:



https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_GS-log_S_S



So this is an example:



gs.log("This is a test", 'MyLogs');



So in this case the source is 'MyLogs' and that's what you need in your BR as a source condition.


Hey Sergiu ,


i didn't get your point.My requirement is i want to capture logs (generated by background script source) and have to store them in another table.



for that i wrote after INSERT business rule on SYSLOG table but it is not triggering even there is a log generated by Background script source.




Thanks,


Dhony.