GraphQL Queries Tutorial

Summary

With LogScale, you can collect server logs and related metrics so that you may monitor the activities on those servers for security attacks, to improve server performance, and other such concerns and objectives.

Administrators and others will need to retrieve data on users, groups, and the configuration of a LogSCale instance. They also will need to know the settings for alerts and other actions. To get any of this data, you'll need to know how to query LogScale. This page covers query syntax and how to execute a query.

Generic Syntax

To begin, consider a very generic query — a fictitious one — called, thing(). It supposedly confirms that a given thing exists in a list of things in LogScale. Below is what its syntax might be;

graphql
thing( name: string! 
         ): boolean

The syntax shows the input wihin parentheses. Input is always given with a key and a value: the name is the key. You would give the name of the thing, the value as a string, within double-quotes.

You may have noticed the exclamation mark. That's meant to indicate that a value is required; you don't type the exclamation mark. Simiarly, after the closing parenthesis there is a colon. You don't enter it in a query. It's meant to indicate that the results of the query follow.

The results for this fake query uses the boolean datatype. This means that a value of true will be returned if the query is successful (i.e., the thing is found), and false if not (i.e., there is no such thing). A third possible result could be returned: if the user doesn't have permission to use the query, or if the query was entered incorrectly, or some other problem occurs, an error message will be returned.