How to count rulenumber in VS Code

Hello,

after i check my logs i see some rule failures.

**Script execution of rule with UID 'test-75' failed**

how is it possible to easily find the line number for the displayed rule 75?

I don’t think it is. That’s a lot of rules in one file. Most people who keep their rules in files split their rules up into multiple files for this and other reasons.

From the command line you could use grep and head perhaps.

grep -n 'rule "' test.rules | head -n 75

Assuming that all the rules start with rule " the last line that command will correspond to the 775’th rule and the -n passed into grep will cause it to show the line number.

Another thing you can do is in MainUI go to Settings → Rules (or open the developer sidebar using alt-shift-d) and search for test-75 and see if any of the information you see there tells you more about what rule is failing (description, triggers, etc.).

thank you.
how is it possible to split the rules in different files?
I thought the filename of rule should be same as the item filename?

You just copy the text that makes up the rule to another file.

There is no restriction of the name of the file. So long as it’s allowed by your operating system and the file ends in .rules it’s allowed.

The same goes for your .items files by the way. You are not restricted to one file and there is no restriction on the name of those files either.

Rules and rule files can be called anything you like, however rule names must be unique (as far as I know). You can have as many files as you want, and as many rules inside the files as you want.