Created
September 5, 2017 04:28
-
-
Save trevor-vaughan/df6a3a0ca42a2c6f59b51d7375fe151a to your computer and use it in GitHub Desktop.
Output an entire Rsyslog configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| base_config = '/etc/rsyslog.conf' | |
| def process_config(config) | |
| output = [] | |
| File.read(config).lines do |line| | |
| if line =~ /IncludeConfig\s+(.*)/ | |
| Dir.glob($1).each do |subfile| | |
| output += process_config(subfile) | |
| end | |
| else | |
| output << line | |
| end | |
| end | |
| return output | |
| end | |
| puts process_config(base_config).join("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment