{"id":27438459,"url":"https://github.com/jwillbold/slog-telegraf","last_synced_at":"2025-04-14T20:39:45.688Z","repository":{"id":57667686,"uuid":"272104900","full_name":"jwillbold/slog-telegraf","owner":"jwillbold","description":"Telegraf drain for slog-rs","archived":false,"fork":false,"pushed_at":"2021-02-19T15:11:59.000Z","size":27,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T12:47:19.577Z","etag":null,"topics":["influxdb","interface","logging","rust","slog-rs","telegraf"],"latest_commit_sha":null,"homepage":"","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/jwillbold.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-14T00:03:29.000Z","updated_at":"2021-02-19T15:12:01.000Z","dependencies_parsed_at":"2022-09-26T20:31:58.871Z","dependency_job_id":null,"html_url":"https://github.com/jwillbold/slog-telegraf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillbold%2Fslog-telegraf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillbold%2Fslog-telegraf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillbold%2Fslog-telegraf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillbold%2Fslog-telegraf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwillbold","download_url":"https://codeload.github.com/jwillbold/slog-telegraf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248958903,"owners_count":21189779,"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":["influxdb","interface","logging","rust","slog-rs","telegraf"],"created_at":"2025-04-14T20:39:41.923Z","updated_at":"2025-04-14T20:39:45.669Z","avatar_url":"https://github.com/jwillbold.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/jwillbold/slog-telegraf.svg?token=hPh87VpFt3MQPwdySdkS\u0026branch=master)](https://travis-ci.com/jwillbold/slog-telegraf)\n[![codecov](https://codecov.io/gh/jwillbold/slog-telegraf/branch/master/graph/badge.svg?token=2EQLM7NCG1)](https://codecov.io/gh/jwillbold/slog-telegraf)\n[![crates.io](https://img.shields.io/crates/v/slog-telegraf.svg)](https://crates.io/crates/slog-telegraf)\n[![docs.rs](https://img.shields.io/badge/docs.rs-current-blue.svg)](https://docs.rs/slog-telegraf)\n\n# slog-telegraf\n\n[Telegraf](https://www.influxdata.com/time-series-platform/telegraf/) drain for [slog-rs](https://github.com/slog-rs/slog).\nFormats the log message and sends it using TCP or UDP to Telegraf. \n\nFeel free to open issues or pull requests.\n\n## Usage\n\nThe logger supports the [TCP and UDP socket listener](https://github.com/influxdata/telegraf/blob/release-1.14/plugins/inputs/socket_listener/README.md) \nof Telegraf and serializes messages according to the [line protocol](https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_tutorial/#syntax).\n\n### Telegraf setup\n```conf\n[[inputs.socket_listener]]\n  service_address = \"tcp://localhost:8094\"\n```\n\nor\n\n```conf\n[[inputs.socket_listener]]\n  service_address = \"udp://localhost:8094\"\n```\n\n### Rust example\n\n```Rust\nuse slog::{Logger, Drain};\nuse slog_telegraf::{TelegrafDrain};\n\nfn main() {\n    let drain = TelegrafDrain::new(\"tcp://127.0.0.1:8094\".into(), \"measurement\".into()).unwrap().fuse();\n    let drain = slog_async::Async::new(drain).build().fuse();\n    \n    let log = Logger::root(drain, o!(\"ver\" =\u003e \"1.2.1\"));\n    info!(log, \"log\"; \"field_key\" =\u003e 10);\n}\n```\n\n## Notes\nThe only values treated as fields are the values passed in the logging call. In the example above, ``field_key=10i`` is a field.\nAll other values are treated as tags. In the example above, ``msg=log,mod=your_crate::main,ver=1.2.1`` are tags. Since tags my not contain\nwhitespaces, it is up to the user to ensure that tag values contain no whitespaces or commas.\n\nFurther, neither tag nor fields keys may contain whitespaces. Thus, log messages as well as all slog value keys may not contain whitespaces.\nslog-telegraf will not validate messages. Instead they will be filtered by Telegraf and not appear in the database.\n\nSince messages with no fields (messages with not parameter besides the log message) are not considered valid by InfluxDB, slog-telegraf appends the dummy\nfield '_dummy=1i' to otherwise field-less messages.\n\n## Performance\nThe project comes with a benchmark test for the serialization. On the test machine, the serializer is capable of serializing ~1 mio messages per second.\n\nIf you care more about performance and less about every log message actually arriving, which is also the design philosophy of slog, \nit is recommended to use the UDP socket.\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwillbold%2Fslog-telegraf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwillbold%2Fslog-telegraf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwillbold%2Fslog-telegraf/lists"}