Cribl puts your IT and Security data at the center of your data management strategy and provides a one-stop shop for analyzing, collecting, processing, and routing it all at any scale. Try the Cribl suite of products and start building your data engine today!
Learn more ›Evolving demands placed on IT and Security teams are driving a new architecture for how observability data is captured, curated, and queried. This new architecture provides flexibility and control while managing the costs of increasing data volumes.
Read white paper ›Cribl Stream is a vendor-agnostic observability pipeline that gives you the flexibility to collect, reduce, enrich, normalize, and route data from any source to any destination within your existing data infrastructure.
Learn more ›Cribl Edge provides an intelligent, highly scalable edge-based data collection system for logs, metrics, and application data.
Learn more ›Cribl Search turns the traditional search process on its head, allowing users to search data in place without having to collect/store first.
Learn more ›Cribl Lake is a turnkey data lake solution that takes just minutes to get up and running — no data expertise needed. Leverage open formats, unified security with rich access controls, and central access to all IT and security data.
Learn more ›The Cribl.Cloud platform gets you up and running fast without the hassle of running infrastructure.
Learn more ›Cribl.Cloud Solution Brief
The fastest and easiest way to realize the value of an observability ecosystem.
Read Solution Brief ›Cribl Copilot gets your deployments up and running in minutes, not weeks or months.
Learn more ›AppScope gives operators the visibility they need into application behavior, metrics and events with no configuration and no agent required.
Learn more ›Explore Cribl’s Solutions by Use Cases:
Explore Cribl’s Solutions by Integrations:
Explore Cribl’s Solutions by Industry:
September 25 | 10am PT / 1pm ET
Hold my beer: lessons from one team’s data pipeline journey
Register ›Try Your Own Cribl Sandbox
Experience a full version of Cribl Stream and Cribl Edge in the cloud.
Launch Now ›Get inspired by how our customers are innovating IT, security and observability. They inspire us daily!
Read Customer Stories ›Sally Beauty Holdings
Sally Beauty Swaps LogStash and Syslog-ng with Cribl.Cloud for a Resilient Security and Observability Pipeline
Read Case Study ›Experience a full version of Cribl Stream and Cribl Edge in the cloud.
Launch Now ›Transform data management with Cribl, the Data Engine for IT and Security
Learn More ›Cribl Corporate Overview
Cribl makes open observability a reality, giving you the freedom and flexibility to make choices instead of compromises.
Get the Guide ›Stay up to date on all things Cribl and observability.
Visit the Newsroom ›Cribl’s leadership team has built and launched category-defining products for some of the most innovative companies in the technology sector, and is supported by the world’s most elite investors.
Meet our Leaders ›Join the Cribl herd! The smartest, funniest, most passionate goats you’ll ever meet.
Learn More ›Whether you’re just getting started or scaling up, the Cribl for Startups program gives you the tools and resources your company needs to be successful at every stage.
Learn More ›Want to learn more about Cribl from our sales experts? Send us your contact information and we’ll be in touch.
Talk to an Expert ›March 12, 2020
Global Variables were one of the most important features introduced with Cribl LogStream 2.1. In this short post we’ll take a look at what they are, how they work and how to use them to build more effective pipelines.
If you’re new to Cribl LogStream it may make sense to take our sandbox for a drive before reading further.
LogStream Global Variables are re-usable and composable expressions for the purposes of storing constants that can be referenced later or storing value expressions that can be invoked with optional arguments. They are managed via Knowledge > Global Variables and can be any of the following types: number, string, boolean, object, array, expression. They are accessed via C.vars.
and can be called anywhere JS expressions are supported in the product, including obviously functions in any pipeline. They’re also typeahead enabled for convenient and contextual help.
The typical use-case is code reuse which simultaneously helps improve expression manageability and intention articulation. For instance, if you find yourself wanting to add current time in epoch format in many pipelines then it’s more convenient to just define a single Global Variable and call it whenever you need it, as opposed to typing the original expression every single time. LogStream ships with an expression variable named: unixtime
. Go to Knowledge > Global Variables and expand unixtime:
Adding a field with Eval, is as easy as calling C.vars.unixtime()
:
Suppose we wanted to convert a field holding a byte size into a human-readable size. E.g., 2048 -> 2KB. We can do that with a simple value expression in Eval. But it’s much easier to have a re-usable definition via Global Variables and call it whenever we need it by passing the field of interest as an argument.
In this example, we’re creating a new field called filesizeHuman
by passing filesize
to the Global Variable as such: C.vars.convertBytes(filesize)
:
Notice how long the expression is, typing it every single time would be tedious and prone to typos or mistakes. Using a Global Variable we now have a single definition that is easy to control, manage and update.
Say we wanted to decorate each event with the inputId of the Source they came from and the LogStream hostname of the Worker that processed it. We can define a Global Variable expression with the following: {'cribl_host': C.os.hostname(), 'cribl_inputId': __inputId}
and then assign it to a field in an Eval function.
The expression evaluates a simple object with the hostname and inputId as below:
Suppose we wanted to drop all events from any pipeline in the system if they match a certain log level – for example, all DEBUG events. Suppose further that later we have a new requirement to drop all TRACE level events, too. As above, we can first add a Drop function with a Filter expression set to level=='DEBUG'
and later go back to each and every pipeline and modify it to level=='DEBUG' || level=='TRACE'
. Or, we can use a Global Variable as a Filter expression, for instance:
C.vars.dropLogLevel
is defined as an array and the includes() method can be used. For good measure, level
can be converted to lowercase before the check.
Using Global Variable decouples definition from the application and allows us to control the expression from a single place instead of modifying all the pipelines where it’s applied at.
—
New to Cribl LogStream? Take our Sandbox for a drive!
If you have any questions or feedback join our community Slack– we’d love to help you out. If you’re looking to join a fast-paced, innovative team drop us a line at hello@cribl.io– we’re hiring!
Rick Salsa Sep 19, 2024
Josh Biggley Sep 17, 2024
Classic choice. Sadly, our website is designed for all modern supported browsers like Edge, Chrome, Firefox, and Safari
Got one of those handy?