<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/go-and-structured-logging-with-elasticsearch-t3ap4clib" -->

---
title: Go and structured logging with ElasticSearch | daily.dev
description: A walkthrough of a small experiment combining Go's logrus logger with Elastic Beats to ship structured logs into Elasticsearch and Kibana. It introduces...
canonical: https://daily.dev/posts/go-and-structured-logging-with-elasticsearch-t3ap4clib
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Go and structured logging with ElasticSearch | daily.dev
og:description: A walkthrough of a small experiment combining Go's logrus logger with Elastic Beats to ship structured logs into Elasticsearch and Kibana. It introduces...
og:url: https://daily.dev/posts/go-and-structured-logging-with-elasticsearch-t3ap4clib
og:image: https://api.daily.dev/og/posts/T3ap4ClIB.png
og:image:alt: Go and structured logging with ElasticSearch
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Go and structured logging with ElasticSearch

**[Teleport](https://daily.dev/sources/teleport)** · 3 min read · 0 upvotes · 0 comments

## Summary

A walkthrough of a small experiment combining Go's logrus logger with Elastic Beats to ship structured logs into Elasticsearch and Kibana. It introduces udpbeat, a custom Beats-based agent that collects UDP log messages from Go processes and forwards them to ELK without requiring services to depend directly on the Elasticsearch API or Beats dependencies. Includes code samples for emitting JSON logs with logrus and trace, running udpbeat, spinning up Elasticsearch and Kibana via Docker, and setting a document schema/template for proper indexing in Kibana.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://goteleport.com/blog/golang-elastic-search>

## Questions this post answers

### How can I send structured logs from a Go application to Elasticsearch and Kibana?

Use the logrus logger with the trace package's UDP hook to emit structured JSON logs, then run udpbeat, a Beats-based agent, to collect those UDP messages and ship them into Elasticsearch. Elasticsearch and Kibana can be started quickly via Docker, and a template.json schema tells Elasticsearch how to index the incoming trace documents so they can be explored in Kibana.

_daily.dev surfaces practical Go logging setups like this for engineers wiring up observability pipelines._

### What is udpbeat and why would I use it instead of shipping logs directly to Elasticsearch?

Udpbeat is a Beats-based agent that listens for UDP log messages and forwards them to ELK, letting application processes emit logs to a lightweight local agent instead of embedding Beats dependencies or calling the Elasticsearch API directly. It runs as a standalone process on any machine, decoupling app code from the logging backend.

_Teams evaluating lightweight log-shipping agents can track approaches like this one on daily.dev._

## Similar posts on daily.dev

- [Shipping Syslog Data to Elasticsearch With Fluent Bit](https://daily.dev/posts/shipping-syslog-data-to-elasticsearch-with-fluent-bit-eyy1tllky) · The New Stack · 0 upvotes · 0 comments
- [Beyond Console.WriteLine: Mastering Structured Logging in .NET](https://daily.dev/posts/beyond-console-writeline-mastering-structured-logging-in-net-hgcoz2ses) · ITNEXT · 10 upvotes · 0 comments
- [Observability in Go: Where to start and what matters most](https://daily.dev/posts/observability-in-go-where-to-start-and-what-matters-most-yxb08zvul) · Grafana Labs · 32 upvotes · 0 comments
- [Structured Logging in .NET with Serilog and ClickHouse](https://daily.dev/posts/structured-logging-in-net-with-serilog-and-clickhouse-xwwes1xel) · ClickHouse · 12 upvotes · 1 comments
- [Observability in Go: What Goes in a Metric, a Log, and a Trace](https://daily.dev/posts/observability-in-go-what-goes-in-a-metric-a-log-and-a-trace-9fz1jzl1o) · Awesome Go · 6 upvotes · 0 comments

---

Tags: [#golang](https://daily.dev/tags/golang), [#docker](https://daily.dev/tags/docker), [#elk](https://daily.dev/tags/elk)

[View this post on daily.dev](https://daily.dev/posts/go-and-structured-logging-with-elasticsearch-t3ap4clib)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Go and structured logging with ElasticSearch","url":"https://daily.dev/posts/go-and-structured-logging-with-elasticsearch-t3ap4clib","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/go-and-structured-logging-with-elasticsearch-t3ap4clib"},"datePublished":"2026-08-23T12:23:31.465Z","dateModified":"2026-08-23T12:59:30.790Z","description":"A walkthrough of a small experiment combining Go's logrus logger with Elastic Beats to ship structured logs into Elasticsearch and Kibana. It introduces...","image":"https://media.daily.dev/image/upload/s--0_ODbtD2--/f_auto/v1722860399/public/Placeholder%2008","thumbnailUrl":"https://media.daily.dev/image/upload/s--0_ODbtD2--/f_auto/v1722860399/public/Placeholder%2008","isAccessibleForFree":true,"articleSection":"Teleport","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Teleport","logo":"https://media.daily.dev/image/upload/s--Dw-Bbw6O--/c_limit,w_256/f_auto,q_auto/v1787487494/logos/teleport?_a=BAMAMicg0","url":"https://daily.dev/sources/teleport"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/go-and-structured-logging-with-elasticsearch-t3ap4clib","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"golang,docker,elk","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Teleport","item":"https://daily.dev/sources/teleport"},{"@type":"ListItem","position":3,"name":"Go and structured logging with ElasticSearch"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/go-and-structured-logging-with-elasticsearch-t3ap4clib#faq","mainEntity":[{"@type":"Question","name":"How can I send structured logs from a Go application to Elasticsearch and Kibana?","acceptedAnswer":{"@type":"Answer","text":"Use the logrus logger with the trace package's UDP hook to emit structured JSON logs, then run udpbeat, a Beats-based agent, to collect those UDP messages and ship them into Elasticsearch. Elasticsearch and Kibana can be started quickly via Docker, and a template.json schema tells Elasticsearch how to index the incoming trace documents so they can be explored in Kibana. daily.dev surfaces practical Go logging setups like this for engineers wiring up observability pipelines."}},{"@type":"Question","name":"What is udpbeat and why would I use it instead of shipping logs directly to Elasticsearch?","acceptedAnswer":{"@type":"Answer","text":"Udpbeat is a Beats-based agent that listens for UDP log messages and forwards them to ELK, letting application processes emit logs to a lightweight local agent instead of embedding Beats dependencies or calling the Elasticsearch API directly. It runs as a standalone process on any machine, decoupling app code from the logging backend. Teams evaluating lightweight log-shipping agents can track approaches like this one on daily.dev."}}]}
```

