Skip to content

Commit 8e97cc6

Browse files
committed
Update rsyslog_logfiles_attributes_modify
Cover cases where File can be part of some other longer word, so the regex consider File as a whole word, also make it case insensitive.
1 parent d0a40db commit 8e97cc6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

shared/templates/rsyslog_logfiles_attributes_modify/oval.template

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
regex now matches both syntaxes.
8787
-->
8888
<ind:pattern
89-
operation="pattern match">^\s*[^#$].*?(?:[Ff]ile="([^"\s]+)"|[\s]+-?(\/[^:;\s]+)).*$</ind:pattern>
89+
operation="pattern match">^\s*[^#$].*?(?:\b[Ff]ile="([^"\s]+)"|[\s]+-?(\/[^:;\s]+)).*$</ind:pattern>
9090
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
9191
<filter action="exclude">state_{{{ _RULE_ID }}}_ignore_include_paths</filter>
9292
</ind:textfilecontent54_object>
@@ -96,9 +96,10 @@
9696
<!-- Among the paths matched in object_{{{ _RULE_ID }}}_log_files_paths there can be paths
9797
from include() or $IncludeConfig statements. These paths are conf files, not log files.
9898
Their properties don't need to be as required for log files, thus, lets exclude them
99-
from the list of objects found. -->
99+
from the list of objects found. Also exclude lines that are part of multiline include
100+
statements (lines starting with whitespace followed by file=) and /dev/* device files. -->
100101
<ind:text
101-
operation="pattern match">(?:include\([\n\s]*file="[^\s;]+"|\$IncludeConfig[\s]+[^\s;]+|\/dev\/.*)</ind:text>
102+
operation="pattern match">(?:include\([\n\s]*\b[Ff]ile="[^\s;]+"|\$IncludeConfig[\s]+[^\s;]+|^\s+\b[Ff]ile="|\/dev\/.*)</ind:text>
102103
</ind:textfilecontent54_state>
103104

104105
<!-- Define OVAL variable to hold all the various system log files locations

0 commit comments

Comments
 (0)