<commit_before># Functions for parsing the syslog-ng config file

do '../web-lib.pl';
&init_config();
do '../ui-lib.pl';

@log_flags = ( "final", "fallback", "catchall" );

# get_syslog_ng_version()
# Returns the version number for syslog-ng, or undef
sub get_syslog_ng_version
{
local $out = &backquote_command("$config{'syslogng_cmd'} -V 2>&1 </dev/null",1);
return $out =~ /syslog-ng\s+([0-9\.]+)/ ? $1 : undef;
}

sub supports_sun_streams
{
return $gconfig{'os_type'} eq 'solaris';
}

# get_config()
# Parses the syslog-ng config file into an array ref of objects
sub get_config
{
if (!defined(@get_config_cache)) {
	# First read file into tokens
	@get_config_cache = &read_config_file($config{'syslogng_conf'});<commit_msg>Use new module<commit_after># Functions for parsing the syslog-ng config file

BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();

@log_flags = ( "final", "fallback", "catchall" );

# get_syslog_ng_version()
# Returns the version number for syslog-ng, or undef
sub get_syslog_ng_version
{
local $out = &backquote_command("$config{'syslogng_cmd'} -V 2>&1 </dev/null",1);
return $out =~ /syslog-ng\s+([0-9\.]+)/ ? $1 : undef;
}

sub supports_sun_streams
{
return $gconfig{'os_type'} eq 'solaris';
}

# get_config()
# Parses the syslog-ng config file into an array ref of objects
sub get_config
{
if (!defined(@get_config_cache)) {
	# First read file into tokens
	@get_config_cache = &read_config_file($config{'syslogng_conf'});
{'fraction_non_alphanumeric': 0.16336295283663704, 'fraction_numerical': 0.008202323991797676, 'mean_word_length': 5.3652173913043475, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5739743', 'n_tokens_mistral': 552, 'n_tokens_neox': 538, 'n_words': 137}