|
|
@ -8,14 +8,18 @@ use Encode qw(encode); |
|
|
|
use Data::Dumper; |
|
|
|
use Data::Dumper; |
|
|
|
use Compress::Zlib; |
|
|
|
use Compress::Zlib; |
|
|
|
use Getopt::Long; |
|
|
|
use Getopt::Long; |
|
|
|
use Config::Any; |
|
|
|
use YAML::Tiny; |
|
|
|
|
|
|
|
|
|
|
|
my $config = '/etc/systemd/journal-gelf.yml'; |
|
|
|
my $config = '/etc/systemd/journal-gelf.yml'; |
|
|
|
my $conf = {}; |
|
|
|
my $conf = {}; |
|
|
|
|
|
|
|
|
|
|
|
if (-e $config) { |
|
|
|
if (-e $config) { |
|
|
|
print "Reading config file $config\n"; |
|
|
|
print "Reading config file $config\n"; |
|
|
|
$conf = Config::Any->load_files( { files => [ $config ], flatten_to_hash => 1, use_ext => 1 } )->{$config}; |
|
|
|
my $yaml = YAML::Tiny->read( $config ) or die "Config file $config is invalid\n"; |
|
|
|
|
|
|
|
if (not $yaml->[0]) { |
|
|
|
|
|
|
|
die "Config file $config is invalid\n" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$conf = $yaml->[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
GetOptions ( |
|
|
|
GetOptions ( |
|
|
|