{"id":24290634,"url":"https://github.com/nocduro/syslog5424","last_synced_at":"2025-07-25T06:06:15.569Z","repository":{"id":57669152,"uuid":"146956292","full_name":"nocduro/syslog5424","owner":"nocduro","description":"A Rust trait based formatter for syslog RFC5424","archived":false,"fork":false,"pushed_at":"2022-03-07T01:43:09.000Z","size":25,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-14T15:04:24.301Z","etag":null,"topics":["logging","rust-crate","rust-trait","syslog"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nocduro.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-01T01:10:01.000Z","updated_at":"2022-03-07T01:43:12.000Z","dependencies_parsed_at":"2022-08-29T08:00:41.716Z","dependency_job_id":null,"html_url":"https://github.com/nocduro/syslog5424","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nocduro/syslog5424","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nocduro%2Fsyslog5424","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nocduro%2Fsyslog5424/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nocduro%2Fsyslog5424/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nocduro%2Fsyslog5424/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nocduro","download_url":"https://codeload.github.com/nocduro/syslog5424/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nocduro%2Fsyslog5424/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265730419,"owners_count":23818765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logging","rust-crate","rust-trait","syslog"],"created_at":"2025-01-16T11:53:56.826Z","updated_at":"2025-07-25T06:06:15.516Z","avatar_url":"https://github.com/nocduro.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⚠This crate will not be maintained or updated⚠\nI no longer use syslog for my logging, I recommend trying out `tracing` or `opentelemetry` instead\n\n# `syslog5424` - trait based syslog 5424 message formatting\n[![Build Status](https://dev.azure.com/nocduro/syslog5424/_apis/build/status/nocduro.syslog5424)](https://dev.azure.com/nocduro/syslog5424/_build/latest?definitionId=3)\n[![crates.io badge](https://img.shields.io/crates/v/syslog5424.svg)](https://crates.io/crates/syslog5424)\n\nThis crate provides a way for data to be formatted as an RFC5424 (or RFC5425) message and written to any type that implements `Write`. \nAny type that implements the `Rfc5424Data` trait can be formatted.\n\n## Documentation\nhttps://docs.rs/syslog5424\n\n## `slog` implementation\nThis crate was originally made as a way to have `slog` format its log messages as rfc 5424.\n\nThe implementation for that is here: https://github.com/nocduro/slog-syslog5424\n\n\n## Example\nThis example shows a minimal implementation of the `Rfc5424Data` trait.\n```rust\n#[derive(Debug)]\npub struct Rfc5424Message\u003c'a\u003e {\n    pub severity: Severity,\n    pub structured_data: Option\u003cStructuredData\u003c'a\u003e\u003e,\n    pub message: Option\u003cMessage\u003e,\n}\n\nimpl\u003c'a\u003e Rfc5424Data for Rfc5424Message\u003c'a\u003e {\n    fn severity(\u0026self) -\u003e Severity {\n        self.severity\n    }\n\n    fn timestamp(\u0026self) -\u003e Option\u003cString\u003e {\n        None\n    }\n\n    fn structured_data(\u0026self) -\u003e Option\u003cStructuredData\u003e {\n        self.structured_data.clone()\n    }\n\n    fn message(\u0026self) -\u003e Option\u003cMessage\u003e {\n        self.message.clone()\n    }\n}\n\nfn main() {\n    // create the formatter struct\n    let formatter = Rfc5424Builder::new(\"enterprise_id\", Facility::User)\n        .hostname(\"api_server_1\").unwrap()\n        .app_name(\"api\").unwrap()\n        .build();\n    \n    // create a message to be formatted\n    let mut hmap: StructuredData = HashMap::new();\n    hmap.insert(\n        \"custom\",\n        vec![\n            (\"id\".into(), \"54\".into()),\n            (\"progress\".into(), \"complete\".into()),\n        ],\n    );\n\n    let msg = Rfc5424Message {\n        severity: Severity::Error,\n        structured_data: Some(hmap),\n        message: Some(Message::Text(\"sample message. Hello there!\".into())),\n    };\n\n    // run the formatter\n    let mut out = Vec::new();\n    formatter.format(\u0026mut out, \u0026msg).unwrap();\n    println!(\"log: {}\", String::from_utf8(out).unwrap());\n}\n```\n\n## OS support\nShould work on any system where `std` is available, the OS specifics are introduced by the user when picking which `Writer` to use.\n\n## License\nMIT (see LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnocduro%2Fsyslog5424","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnocduro%2Fsyslog5424","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnocduro%2Fsyslog5424/lists"}