[logs] Collect /var/lib/rsyslog/ directory listings - #4463
Conversation
Add directory listings for /var/lib/rsyslog/ to help diagnose rsyslog state file issues and verify SELinux contexts on the path hierarchy. Commands fail gracefully when rsyslog is not installed or uses a non-default WorkDirectory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Amey Betkiker <abetkike@redhat.com>
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
| self.add_cmd_output([ | ||
| "ls -ldZ /var/ /var/lib/ /var/lib/rsyslog/", | ||
| "ls -lZ /var/lib/rsyslog/", | ||
| ]) |
There was a problem hiding this comment.
Plugin.get_dir_listing() exists for standardized directory listing collections. Please use that for these.
There was a problem hiding this comment.
Thank you for the review feedback @TurboTurtle . I've revised the code to use Plugin.add_dir_listing() for the rsyslog directory collections (note: I used add_dir_listing() as that's the available method - I assume that's what you meant by get_dir_listing()).
Current implementation (revised):
self.add_dir_listing(['/var/', '/var/lib/', '/var/lib/rsyslog/'],
extra_opts='d')
self.add_dir_listing('/var/lib/rsyslog/')
My question:
The first call uses add_dir_listing() with extra_opts='d' to show the directory hierarchy with SELinux labels. This generates three separate output files (one per path):
- ls_-alZd_.var
- ls_-alZd_.var.lib
- ls_-alZd_.var.lib.rsyslog
The original command (ls -ldZ /var/ /var/lib/ /var/lib/rsyslog/) captured this hierarchy in a single file, which made it easier to see the SELinux context progression along the path.
Would you prefer:
- Current approach: Both commands use add_dir_listing()
- Mixed approach: Keep hierarchy as add_cmd_output("ls -ldZ /var/ /var/lib/ /var/lib/rsyslog/") (single file), and use add_dir_listing() only for the directory contents
Thanks for your guidance!
There was a problem hiding this comment.
in my opinion, we should use add_dir_listing() for both
Add directory listings for /var/lib/rsyslog/ to help diagnose
rsyslog state file issues and verify SELinux contexts on the
path hierarchy. Commands fail gracefully when rsyslog is not
installed or uses a non-default WorkDirectory.
Collects:
ls -ldZ /var/ /var/lib/ /var/lib/rsyslog/— path hierarchy with SELinux labelsls -lZ /var/lib/rsyslog/— directory contents with SELinux labels