Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate search_path for client and service. Support search_path_prefix for client #353

Closed
binaek opened this issue Apr 7, 2021 · 0 comments · Fixed by #356
Closed

separate search_path for client and service. Support search_path_prefix for client #353

binaek opened this issue Apr 7, 2021 · 0 comments · Fixed by #356
Assignees
Labels
enhancement New feature or request

Comments

@binaek
Copy link
Contributor

binaek commented Apr 7, 2021

See search path section of https://github.com/turbotio/osquery-extensions/wiki/Steampipe-mods-&-workspaces

Setting the search path

By default, the search path puts the public schema first, followed by all connection schemas, ordered alphabetically.

You may change the default in the steampipe config file in the database options. This will change the search path in the database. This means that this path will be the default even when connecting to the Steampipe database from 3rd party tools.

options "database" {
  search_path  =  "aws01,gcp01,azure01,github,slack,whois"
}

You may also change the default in the terminal options. This will change the search path for the session when connecting via Steampipe, but it does NOT change the setting in the database; the search path set in terminal options will NOT be in effect when connecting directly to the Steampipe database from 3rd party tools.

You may set the terminal options globally (in ~/.steampipe/config/default.spc), and the setting will override the database level setting when using Steampipe. You may also set the search path on a per-workspace basis in the workspace.spc file; if set, the workspace setting will override any global setting.

options "terminal" {
  search_path  =  "aws01,gcp01,azure01,github,slack,whois"
}

Alternatively, you may use search_path_prefix in the terminal options. The search_path is a comma-separated list of connection names that will define the exact search path. search_path_prefix is also a comma separated list of connections, but it used to move connections to the front of the search path. This is useful when you want to prefer a specific connection for one or more plugin types, but to still include the rest in the search path. For instance, I may have many aws connections, and I would like to prefer aws01 in my workspace but still leave all the other connections (github, slack, shodan, etc) in the search path as well. While this is possible using search_path, you would need to update the search_path every time you install a new plugin. This is simple and dynamic, however, when using search_path_prefix:

options "terminal" {
 search_path_prefix  =  "aws01"
}

You may override the config file settings with the --search-path or --search-path-prefix command line arguments:

  • Set the search path exactly:
steampipe query --search_path "aws_account1,gcp,azure,github"
  • Move the aws01 and gcp01 connections to the front of the search path:
steampipe query --search-path-prefix "aws01,gcp01"

You can also set the search path for the duration of your interactive session with a the .search_path or .search_path_prefix meta-commands. These settings will last for the duration of the session, and behave the same as the search_path and search_path_prefix options:

  • Set the search path exactly:
.search_path aws_account1,gcp,azure,github
  • move the aws01 and gcp01 connections to the front of the search path:
.search_path_prefix aws01,gcp01

You can view your current active search path by issuing the .search_path meta-command with no arguments

> .search_path
public, alicloud, aws, aws_01, aws_02, aws_03, azure, azure_01, digitalocean, gcp, github, hackernews, ipstack, kubernetes, oci, public, rss, slack, steampipe, whois, zendesk, internal
@binaek binaek added the enhancement New feature or request label Apr 7, 2021
@binaek binaek self-assigned this Apr 7, 2021
@binaek binaek linked a pull request Apr 7, 2021 that will close this issue
@kaidaguerre kaidaguerre changed the title separate search_path for cli and service separate search_path for client and service Apr 8, 2021
@kaidaguerre kaidaguerre changed the title separate search_path for client and service separate search_path for client and service. Support search_path_prefix for client Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant