How-To: Block Queries using GraphQL

As a root user on your LogScale cluster you might need to block some queries. If you want to know more about the reasons to block queries on your LogScale Cluster, have a look at Blocking Queries.

You can block queries from the Cluster Administration page or you can use alternatively the GraphQL API.

Get the list of the queries that are currently blocked on your LogScale instance:

graphql
query {
  blockedQueries {
    id
    pattern
    view {
      name
    }
  }
}

As you can see the queries are blocked in relationship to a specific view/repo.

Add a query to the blocklist with the following mutation:

default
mutation {
  addToBlocklist(input: {pattern: "<QUERY_SEARCH>",type:<REGEX/EXACT>,viewName:"<REPO_NAME"}) {
  id
  }
}

Specify the query to be blocked in the pattern field of the input. The type field specifies if the pattern is a REGEX, to hit a set of queries corresponding to the regex, or if it's EXACT, that means the block is related to a specific query.

Once the query has been blocked whoever will try to run it on that repository will get an error on the UI saying that the query has been locked by an administrator.

If at some point the issue with that query is solved, you can remove it from the blocklist with the following mutation

default
mutation {
  removeFromBlocklist (input: {id: #BlockedQueryID#}){
  }
}

You can easily find the ID by running the blockedQueries query.