mirror of
https://github.com/sadoyan/aralez.git
synced 2026-10-23 06:01:35 +08:00
Making custom Elsticsearch logger.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::core::proxyhttp::LB;
|
||||
use crate::ingress::{APIUpstreamProvider, ConsulProvider, Discovery, FromFileProvider, KubernetesProvider};
|
||||
use crate::logging::core::init_access_logging;
|
||||
use crate::logging::core::{init_access_log, init_access_logging, log_builder};
|
||||
use crate::tls::acme::order::refresh_order;
|
||||
use crate::utils::metrics::calc_cache_metrics;
|
||||
use crate::utils::parceyaml::load_configuration;
|
||||
@@ -19,6 +19,10 @@ use tokio::sync::mpsc;
|
||||
#[async_trait]
|
||||
impl BackgroundService for LB {
|
||||
async fn start(&self, mut shutdown: ShutdownWatch) {
|
||||
log_builder(&self.config, &self.config.log_file).await;
|
||||
let al = &self.config.access_log.clone().unwrap_or("none".to_string());
|
||||
let _ = init_access_log(al.as_str()).await;
|
||||
|
||||
info!("Starting background service"); // tx: Sender<Configuration>
|
||||
let (tx, mut rx) = mpsc::channel::<Configuration>(1);
|
||||
let tx_api = tx.clone();
|
||||
@@ -80,7 +84,8 @@ impl BackgroundService for LB {
|
||||
}));
|
||||
drop(tokio::spawn(async move { calc_cache_metrics().await }));
|
||||
drop(tokio::spawn(async move { refresh_order(certdir, confdir).await }));
|
||||
init_access_logging(self.config.access_log.clone());
|
||||
|
||||
init_access_logging(self.config.access_log.clone()).await;
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = shutdown.changed() => {
|
||||
|
||||
@@ -355,7 +355,7 @@ impl ProxyHttp for LB {
|
||||
}
|
||||
}
|
||||
}
|
||||
access_log(response_code, &self.request_summary(session, ctx), session);
|
||||
access_log(response_code, &self.request_summary(session, ctx), session).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
use crate::core::proxyhttp::LB;
|
||||
use crate::logging::core::init_access_log;
|
||||
use crate::tls::grades;
|
||||
use crate::tls::load;
|
||||
use crate::tls::load::CertificateConfig;
|
||||
@@ -71,8 +70,8 @@ pub fn run() {
|
||||
extraparams: ec_config,
|
||||
cache_enabled: cache_enabled,
|
||||
};
|
||||
let al = cfg.access_log.clone().unwrap_or("none".to_string());
|
||||
init_access_log(al.as_str());
|
||||
// let al = cfg.access_log.clone().unwrap_or("none".to_string());
|
||||
// init_access_log(al.as_str());
|
||||
|
||||
let grade = cfg.proxy_tls_grade.clone().unwrap_or("medium".to_string());
|
||||
info!("TLS grade set to: [ {} ]", grade);
|
||||
|
||||
Reference in New Issue
Block a user