1--- 2last_modified_on: "2020-07-13" 3$schema: "/.meta/.schemas/guides.json" 4title: "Send logs from STDIN to a TCP, UDP, or UDS socket" 5description: "A simple guide to send logs from STDIN to a TCP, UDP, or UDS socket in just a few minutes." 6author_github: https://github.com/binarylogic 7cover_label: "STDIN to Socket Integration" 8tags: ["type: tutorial","domain: sources","domain: sinks","source: stdin","sink: socket"] 9hide_pagination: true 10--- 11 12import ConfigExample from '@site/src/components/ConfigExample'; 13import InstallationCommand from '@site/src/components/InstallationCommand'; 14import Jump from '@site/src/components/Jump'; 15import SidecarDiagram from '@site/src/components/SidecarDiagram'; 16import Steps from '@site/src/components/Steps'; 17 18Logs are an _essential_ part of observing any 19service; without them you are flying blind. But collecting and analyzing them 20can be a real challenge -- especially at scale. Not only do you need to solve 21the basic task of collecting your logs, but you must do it 22in a reliable, performant, and robust manner. Nothing is more frustrating than 23having your logs pipeline fall on it's face during an 24outage, or even worse, disrupt more important services! 25 26Fear not! In this guide we'll show you how to send send logs from [STDIN][urls.stdin] to [a TCP, UDP, or UDS socket][urls.socket] 27and build a logs pipeline that will be the backbone of 28your observability strategy. 29 30<!-- 31 THIS FILE IS AUTOGENERATED! 32 33 To make changes please edit the template located at: 34 35 website/guides/integrate/sources/stdin/socket.md.erb 36--> 37 38## Strategy 39 40### How This Guide Works 41 42We'll be using [Vector][urls.vector_website] to accomplish this task. Vector 43is a [popular][urls.vector_stars] [open-source][urls.vector_repo] utility for 44building observability pipelines. It's written in [Rust][urls.rust], making it 45lightweight, [ultra-fast][urls.vector_performance] and highly reliable. And 46we'll be deploying Vector as a 47[sidecar][docs.strategies#sidecar]. 48 49The [sidecar deployment strategy][docs.strategies#sidecar] is designed to 50collect data from a _single_ service. Vector has a tight 1 to 1 coupling with 51each service. Typically data is collected by tailing local files via Vector's 52[`file` source][docs.sources.file], but can be collected through any of Vector's 53[sources][docs.sources]. The following diagram demonstrates how it works. 54 55<SidecarDiagram 56 platformName={null} 57 sourceName={"stdin"} 58 sinkName={"socket"} /> 59 60### What We'll Accomplish 61 62To be clear, here's everything we'll accomplish in this short guide: 63 64<ul className="list--icons list--icons--checks list--indent"> 65 <li> 66 Accept new line delimited log data through STDIN. 67 <ul> 68 <li>Automatically enrich logs with host-level context.</li> 69 </ul> 70 </li> 71 <li> 72 Stream logs over a TCP, UDP, or Unix socket. 73 <ul> 74 <li>Buffer your data in-memory or on-disk for performance and durability.</li> 75 </ul> 76 </li> 77 <li className="list--icons--arrow text--pink text--bold">All in just a few minutes!</li> 78</ul> 79 80## Tutorial 81 82<Steps headingDepth={3}> 83<ol> 84<li> 85 86### Install Vector 87 88<InstallationCommand /> 89 90Or choose your [preferred method][docs.installation]. 91 92</li> 93<li> 94 95### Configure Vector 96 97<ConfigExample 98 format="toml" 99 path={"vector.toml"} 100 sourceName={"stdin"} 101 sinkName={"socket"} /> 102 103</li> 104<li> 105 106### Start Vector 107 108```bash 109vector --config vector.toml 110``` 111 112That's it! Simple and to the point. Hit `ctrl+c` to exit. 113 114</li> 115</ol> 116</Steps> 117 118## Next Steps 119 120Vector is _powerful_ utility and we're just scratching the surface in this 121guide. Here are a few pages we recommend that demonstrate the power and 122flexibility of Vector: 123 124<Jump to="https://github.com/timberio/vector" leftIcon="github" target="_blank"> 125 <div className="title">Vector Github repo <span className="badge badge--primary"><i className="feather icon-star"></i> 4k</span></div> 126 <div className="sub-title">Vector is free and open-source!</div> 127</Jump> 128 129<Jump to="/guides/getting-started/" leftIcon="book"> 130 <div className="title">Vector getting started series</div> 131 <div className="sub-title">Go from zero to production in under 10 minutes!</div> 132</Jump> 133 134<Jump to="/docs/about/what-is-vector/" leftIcon="book"> 135 <div className="title">Vector documentation</div> 136 <div className="sub-title">Thoughtful, detailed docs that respect your time.</div> 137</Jump> 138 139[docs.installation]: /docs/setup/installation/ 140[docs.sources.file]: /docs/reference/sources/file/ 141[docs.sources]: /docs/reference/sources/ 142[docs.strategies#sidecar]: /docs/setup/deployment/strategies/#sidecar 143[urls.rust]: https://www.rust-lang.org/ 144[urls.socket]: https://en.wikipedia.org/wiki/Network_socket 145[urls.stdin]: https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin) 146[urls.vector_performance]: https://vector.dev/#performance 147[urls.vector_repo]: https://github.com/timberio/vector 148[urls.vector_stars]: https://github.com/timberio/vector/stargazers 149[urls.vector_website]: https://vector.dev 150