-
Notifications
You must be signed in to change notification settings - Fork 196
Add combiner for rsyslog_conf #2121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
insights/specs/__init__.py
Outdated
| route = RegistryPoint() | ||
| rpm_V_packages = RegistryPoint() | ||
| rsyslog_conf = RegistryPoint(filterable=True) | ||
| rsyslog_conf = RegistryPoint() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this spec was already filtered, this change will have to go through the approval process.
| if match: | ||
| self.config_items[match.group('name')] = match.group('value') | ||
|
|
||
| def config_val(self, item, default=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would break backward compatibility for this parser so you need to keep it in the parser. It seems like it might be better to have two parsers here since that are different, and use the IsRhel[6|7|8] components to trigger which parser is executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.config_items is used to store configuration like "$ModLoad imtcp", however, former code can not handle multi lines. Per our discussion in #1952, I combine the multi lines into one line and not parse it as key-value format, directly return content line by line. Also, this code can handle rsyslog.conf in RHEL6|7|8, no need to use IsRhel[6|7|8] components. I cretaed a issue to remove this function, #2130
xiangce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And You may forget to add a .rst file for this new combiner.
|
uploader.json update: RedHatInsights/insights-core-assets#247 |
| root_crontab = RegistryPoint() | ||
| route = RegistryPoint() | ||
| rpm_V_packages = RegistryPoint() | ||
| rsyslog_conf = RegistryPoint(filterable=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wushiqinlou you need to keep filterable here. You can add {}() to a filter in the parser to ensure you get your opening and closing chars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bfahr - I think we can return all the content of configuration file, and no need to add filter. If we keep filterable, and add filter for {}() in parser, we may miss necessary content like line 90, 91 in test_rsyslog_confs.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bfahr - Will add filterable as your suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bfahr - Updated as your suggestion, please have a check.
|
Can one of the admins verify this patch? |
|
@bfahr - Could you please have a check? Any further comment on discussion of adding filterable. |
53099b9 to
a78a7f0
Compare
|
@wushiqinlou please rebase your PR to clear up merge conflicts. |
17a5f87 to
64fb55f
Compare
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
64fb55f to
bcd6d92
Compare
* Add combiner for rsyslog_conf Signed-off-by: jiazhang <[email protected]> * Fix up class Signed-off-by: jiazhang <[email protected]> * Change self.data Signed-off-by: jiazhang <[email protected]> * Remove self.config_items Signed-off-by: jiazhang <[email protected]> * Use list as up class Signed-off-by: jiazhang <[email protected]> * Add multi_output=True Signed-off-by: jiazhang <[email protected]> * Add docstring Signed-off-by: jiazhang <[email protected]> * Update parser rsyslog (#2732) Signed-off-by: jiazhang <[email protected]> (cherry picked from commit a34c001)
|
@xiangce - I updated insights-plugins and gss-rules accordingly, please have a check. |
* Add combiner for rsyslog_conf Signed-off-by: jiazhang <[email protected]> * Fix up class Signed-off-by: jiazhang <[email protected]> * Change self.data Signed-off-by: jiazhang <[email protected]> * Remove self.config_items Signed-off-by: jiazhang <[email protected]> * Use list as up class Signed-off-by: jiazhang <[email protected]> * Add multi_output=True Signed-off-by: jiazhang <[email protected]> * Add docstring Signed-off-by: jiazhang <[email protected]> * Update parser rsyslog (#2732) Signed-off-by: jiazhang <[email protected]>
Before RHEL8, the format of rsyslog.conf is like:
However, it changes like following in RHEL8:
We also need to consider the
RainerScriptwhen parsing rsyslog.conf, then it becomes too complicated if we want to parse this file in detail. Per our discussion in #1952, we decide to return the content directly with format line by line. AsLogFileOutputcan not handle multi lines, I do not use this class, and parse the content with my own code. Also, if we use filter for multi lines, we will get only one line and it may not be useful for plugin check, so I remove the filter.