Search code examples
sumologic

Is there a way in SumoLogic to store some data and use it in queries?


I have a list of IPs that I want to filter out of many queries that I have in sumo logic. Is there a way to store that list of IPs somewhere so it can be referenced, instead of copy pasting it in every query?

For example, in a perfect world it would be nice to define a list of things like:

things=foo,bar,baz

And then in another query reference it:

where mything IN things

Right now I'm just copying/pasting. I think there may be a way to do this by setting up a custom data source and putting the IPs in there, but that seems like a very round-about way of doing it, and wouldn't help to re-use parts of a query that aren't data (eg re-use statements). Also their template feature is about parameterizing a query, not re-use across many queries.


Solution

  • Yes. There's a notion of Lookup Tables in Sumo Logic. Consult: https://help.sumologic.com/docs/search/lookup-tables/create-lookup-table/ for details.

    It allows to store some values (either manually once, or in a scheduled way as as a result of some query) with | save operator. And then you can refer to these values using | lookup which is conceptually similar to SQL's JOIN.

    Disclaimer: I am currently employed by Sumo Logic.