Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

ELK Exploration Companion

May 5, 2017
ryan birmingham
Related topics:
Open source
Related products:
Red Hat OpenShift

    ELK

    ELK (or Elastic stack) is the name for the Elasticsearch/Logstash/Kibana stack. Logstash gets log information, reports it to Elasticsearch for searching, and Kibana lets you analyze it. While the tools work independently, and with other software, they play together especially well. To understand what’s going on, let’s look at each one individually. This guide is meant to be a bit of a guided tour to each of these services.

    Elasticsearch

    Elasticsearch is a real-time search and analytics engine. It’s distributed and built on Apache’s Lucene. Curl it requests to default port 9200 like:

    (curl -X<VERB> '<PROTOCOL>://<HOST>:<PORT>/<PATH>?<QUERY_STRING>' -d '<BODY>');

    it will respond with a json; alternatively, you can use sense (a Kibana app) to query directly from the browser. (More on Kibana later, just keep this in the back of your head)

    Insert data with PUT /{index name}/{type}/{id}; get with GET /{index name}/{type}/{id}.

    Use GET /{index name}/{type}/_search to get all, append with ?q={field}:{value} to search more Domain-specific language (DSL); can use a get body to /{index name}/{type}/_search.

    DSL allows for queries that are more specific and makes them easier to read. Look at some examples! Searches will often provide relevance scores. You can use constant_score to avoid scoring and exact matches.

    Filters let you narrow down your searches; they can (and should) be nested:

    • Bool has four fields, must, should, must_not, and filter; filter runs the query in non-scoring mode.
      • Many filters use bool to deal with multi-part/multi-word queries.
    • Terms can take an array instead of a value, which searches for any that match; use tags and tag_count within to specify more specific matches.
    • Use range with GT, LT, gte, and/or LTE to search on ranges.
      • For dates, can use things like now-1m, {timestamp}||+1M.
        • Be aware of date format marks though!
      • Strings search in lexicographic order.
    • Dealing with null.
      • Exists deals with null values (if a value is not stored in post, it’s null).
      • Missing does the opposite of exists.
      • For both of the above, note that you may need to choose a null_value to store an actual/intentional null value.
      • Exists/missing will reduce to bool -> should on subfields if applicable.
    • Full-text has an analysis phase, unlike term-based.
      • Match is the general “find this thing” query.
      • Multi-word match queries are bool -> should; can use operator: and to change to must.
      • Can boost: # to add a weight (default 1).

    Aggregations are an important part of Elasticsearch. Buckets are documents that meet a criterion; you set those using aggs in a query. Metrics are statistics on a bucket’s documents, like SQL COUNT, AVG, SUM, etc. You can nest both of these.

    You can monitor the Elasticsearch status in kibana using the x-pack plugin. Alternatively, you can use curl directly:

        • GET _cluster/health returns status, nodes, shards, etc
        • GET _nodes/stats to check individual nodes, their indices
        • GET _cluster/stats to get similar info to node stats but aggregated for the whole cluster
        • GET {index}/_stats to get stats about that index, or GET _all/_stats for all
        • GET _cluster/pending_tasks to see if any tasks are pending
        • GET /_cat to see a list of endpoints which return more linux-like tabular info, instead of json

    Logstash

    Logstash is a log formatter/aggregator and operates on a pipeline. Make a pipeline configuration file to describe what you want to happen to the logs. A pipeline includes inputs, filters, and outputs (and codecs). To use a pipeline, run logstash like “{path}bin/logstash -f {pipeline file} --config.reload.automatic”, which allows auto config changes without stopping.

    Inputs are ways that data enters the pipeline. Some common ones:

    • Beat: Filebeat collects logs from server files
    • File, like unix tail -0F
    • Syslog listens on port 514
    • Redis for Redis server

    Filters are actions taken on the logs during processing.  Some common ones:

    • Grok to parse and structure arbitrary text (built in)
    • Mutate for specific changes (rename, remove, replace, modify, etc)
    • Drop / clone
    • GeoIP to add go ip info

    Outputs are destinations from the pipeline. Some common ones:

    • Elasticsearch (you want this if you’re doing ELK)
    • File
    • Graphite - another open source tool
    • Statsd, which listens for statistics over udp

    Codecs allow you to change the output format (like json, or multiline).

    For all parts of the pipeline, you can add more plugins of any of these types to match your needs.

    Monitoring

    • Can use ?human={true|false} or ?pretty={true|false} to tune for debugging
    • GET commands
      • / for general
      • /_node_/pipeline for pipeline info
      • /_node/os for node os info
      • /_node/jvm for jvm info
      • /_node/plugins for any plugins
      • /_node/stats/{jvm|process|mem|pipeline} to get some useful statistics
      • /_node/hot_threads to see what threads are running with high cpu for long

    Kibana

    Honestly, the best way to get to know Kibana is to try it. Elastic (who makes all ELK components) hosted a demo here: demo.elastic.co/.

    Alternatively, set up your own: Install from a package (deb or rpm) and run sudo -i service kibana start to start it. It listens on localhost:5601 by default.

    Double alternatively, you can get a docker image with kibana and x-pack already there, so it can easily connect to elasticsearch.

    • Quick guide to Kibana
      • Discover lets you see what fields are available, and do quick searches.
      • Visualize lets you make charts out of saved searches. Be sure to click the “play” button to update the visualization with changes.
      • A dashboard can be created out of visualizations to get a sense of what’s going on. I highly recommend making at least something similar to a “server/app status” one.
      • Management just lets you manage saved searches/dashboards, kibana/search configuration, and reporting to another source.
      • Dev tools help you develop for or with the ELK stack.

    X-Pack

    X-pack is not part of the ELK stack, but it’s useful in using it. It adds a sign on and additional security, alerting conditions, monitoring for the components of ELK, graph visualization to Kibana, and pdf reports.


    Developers can now get a no-cost Red Hat Enterprise Linux® Developer Suite subscription for development purposes by registering and downloading through developers.redhat.com.

    Last updated: February 24, 2024

    Recent Posts

    • Trusted software factory: Building trust in the agentic AI era

    • Build a zero trust AI pipeline with OpenShift and RHEL CVMs

    • Red Hat Hardened Images: Top 5 benefits for software developers

    • How EvalHub manages two-layer Kubernetes control planes

    • Tekton joins the CNCF as an incubating project

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.