Skip to content

Commit

Permalink
Tweak syslog format
Browse files Browse the repository at this point in the history
  • Loading branch information
lookback-hugotunius committed Nov 20, 2024
1 parent 7722ec3 commit 27910f0
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,8 @@ mod system {
use std::io::Write;
let pri = (*record.facility as u8) * 8 + (record.severity as u8);

// 2019-03-18T13:12:27.000+00:00
let time = record.timestamp.format("%Y-%m-%dT%H:%M:%S%.3f%:z");
let hostname = chk(record.hostname.as_str());
let app_name = chk(record.app_name.as_str());
let msg_id = chk(&record.msg_id);
let pid = record.pid;
let env = record.env.as_str();
let msg = StripCtrl(record.message.as_ref().map(|s| s.as_str()).unwrap_or(""));
let mut socket_and_buf = self.socket_and_buf.lock().unwrap();
let (socket, buf) = socket_and_buf.deref_mut();
Expand All @@ -256,10 +251,7 @@ mod system {
// Clear out the buffer
buf.clear();

write!(
buf,
r#"<{pri}>1 {time} {hostname} {app_name} {pid} {msg_id} [env="{env}"] {msg}"#
);
write!(buf, r#"<{pri}>{app_name}[{pid}]: {msg}"#);

if let Some(w) = &record.well_known {
write!(buf, " ");
Expand Down

0 comments on commit 27910f0

Please sign in to comment.