Skip to content

Conversation

@wushiqinlou
Copy link
Contributor

@wushiqinlou wushiqinlou commented Jul 31, 2019

Before RHEL8, the format of rsyslog.conf is like:

$IncludeConfig /etc/rsyslog.d/*.conf
$ModLoad imtcp

However, it changes like following in RHEL8:

include(file="/etc/rsyslog.d/*.conf" mode="optional")
module(load="imuxsock" 
       SysSock.Use="off")

We also need to consider the RainerScript when 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. As LogFileOutput can 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.

@wushiqinlou wushiqinlou requested a review from xiangce July 31, 2019 07:26
@xiangce xiangce added the SPEC Change needs SPEC approval label Jul 31, 2019
route = RegistryPoint()
rpm_V_packages = RegistryPoint()
rsyslog_conf = RegistryPoint(filterable=True)
rsyslog_conf = RegistryPoint()
Copy link
Contributor

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):
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@xiangce xiangce left a 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.

@wushiqinlou
Copy link
Contributor Author

wushiqinlou commented Aug 2, 2019

uploader.json update: RedHatInsights/insights-core-assets#247

root_crontab = RegistryPoint()
route = RegistryPoint()
rpm_V_packages = RegistryPoint()
rsyslog_conf = RegistryPoint(filterable=True)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@jenkins-qa-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@wushiqinlou
Copy link
Contributor Author

@bfahr - Could you please have a check? Any further comment on discussion of adding filterable.

@xiangce xiangce force-pushed the Add_combiner_for_rsyslog_conf branch from 53099b9 to a78a7f0 Compare August 27, 2020 02:50
@bfahr
Copy link
Contributor

bfahr commented Nov 4, 2020

@wushiqinlou please rebase your PR to clear up merge conflicts.

@xiangce xiangce force-pushed the Add_combiner_for_rsyslog_conf branch from 17a5f87 to 64fb55f Compare November 6, 2020 01:58
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]>
@xiangce xiangce force-pushed the Add_combiner_for_rsyslog_conf branch from 64fb55f to bcd6d92 Compare November 6, 2020 02:00
@xiangce xiangce merged commit a34c001 into master Nov 6, 2020
@xiangce xiangce deleted the Add_combiner_for_rsyslog_conf branch November 6, 2020 06:31
xiangce pushed a commit that referenced this pull request Nov 6, 2020
* 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 added a commit that referenced this pull request Nov 6, 2020
xiangce added a commit that referenced this pull request Nov 6, 2020
xiangce added a commit that referenced this pull request Nov 6, 2020
This reverts commit a34c001.

(cherry picked from commit a7fa07f)
@wushiqinlou
Copy link
Contributor Author

wushiqinlou commented Nov 7, 2020

@xiangce - I updated insights-plugins and gss-rules accordingly, please have a check.

xiangce added a commit that referenced this pull request Nov 9, 2020
xiangce added a commit that referenced this pull request Nov 9, 2020
xiangce added a commit that referenced this pull request Nov 9, 2020
xiangce pushed a commit that referenced this pull request Sep 6, 2024
* 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]>
xiangce added a commit that referenced this pull request Sep 6, 2024
xiangce added a commit that referenced this pull request Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SPEC Change needs SPEC approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants