synapse.cmds package
Submodules
synapse.cmds.boss module
- class synapse.cmds.boss.KillCmd(cli, **opts)[source]
Bases:
synapse.lib.cli.Cmd
Kill a running task/query within the cortex.
- Syntax:
kill <iden>
Users may specify a partial iden GUID in order to kill exactly one matching process based on the partial guid.
- class synapse.cmds.boss.PsCmd(cli, **opts)[source]
Bases:
synapse.lib.cli.Cmd
List running tasks in the cortex.
synapse.cmds.cortex module
- class synapse.cmds.cortex.Log(cli, **opts)[source]
Bases:
synapse.lib.cli.Cmd
Add a storm log to the local command session.
Notes
By default, the log file contains all messages received from the execution of a Storm query by the current CLI. By default, these messages are saved to a file located in ~/.syn/stormlogs/storm_(date).(format).
Examples
# Enable logging all messages to mpk files (default) log –on
# Disable logging and close the current file log –off
# Enable logging, but only log edits. Log them as jsonl instead of mpk. log –on –edits-only –format jsonl
# Enable logging, but log to a custom path: log –on –path /my/aweome/log/directory/storm20010203.mpk
# Log only the node messages which come back from a storm cmd execution. log –on –nodes-only –path /my/awesome/log/directory/stormnodes20010203.mpk
- async runCmdOpts(opts)[source]
Perform the command actions. Must be implemented by Cmd implementers.
- Parameters
opts (dict) – Options dictionary.
- splicetypes = ('tag:add', 'tag:del', 'node:add', 'node:del', 'prop:set', 'prop:del', 'tag:prop:set', 'tag:prop:del')
- class synapse.cmds.cortex.StormCmd(cli, **opts)[source]
Bases:
synapse.lib.cli.Cmd
Execute a storm query.
- Syntax:
storm <query>
- Parameters
query – The storm query
- Optional Arguments:
–hide-tags: Do not print tags. –hide-props: Do not print secondary properties. –hide-unknown: Do not print messages which do not have known handlers. –show-nodeedits: Show full nodeedits (otherwise printed as a single . per edit). –editformat <format>: What format of edits the server shall emit.
- Options are
nodeedits (default),
splices (similar to < 2.0.0),
count (just counts of nodeedits), or
none (no such messages emitted).
–show-prov: Show provenance messages. –raw: Print the nodes in their raw format. This overrides –hide-tags and –hide-props. –debug: Display cmd debug information along with nodes in raw format. This overrides other display arguments. –path: Get path information about returned nodes. –show <names>: Limit storm events (server-side) to the comma-separated list. –file <path>: Run the storm query specified in the given file path. –optsfile <path>: Run the query with the given options from a JSON/YAML file.
Examples
storm inet:ipv4=1.2.3.4 storm –debug inet:ipv4=1.2.3.4
- editformat_enums = ('nodeedits', 'splices', 'count', 'none')
synapse.cmds.cron module
- class synapse.cmds.cron.At(cli, **opts)[source]
Bases:
synapse.lib.cli.Cmd
Adds a non-recurring cron job.
It will execute a Storm query at one or more specified times.
List/details/deleting cron jobs created with ‘at’ use the same commands as other cron jobs: cron list/stat/del respectively.
- Syntax:
at (time|+time delta)+ {query}
Notes
This command accepts one or more time specifications followed by exactly one storm query in curly braces. Each time specification may be in synapse time delta format (e.g + 1 day) or synapse time format (e.g. 20501217030432101). Seconds will be ignored, as cron jobs’ granularity is limited to minutes.
All times are interpreted as UTC.
The other option for time specification is a relative time from now. This consists of a plus sign, a positive integer, then one of ‘minutes, hours, days’.
Note that the record for a cron job is stored until explicitly deleted via “cron del”.
Examples
# Run a storm query in 5 minutes at +5 minutes {[inet:ipv4=1]}
# Run a storm query tomorrow and in a week at +1 day +7 days {[inet:ipv4=1]}
# Run a query at the end of the year Zulu at 20181231Z2359 {[inet:ipv4=1]}
- class synapse.cmds.cron.Cron(cli, **opts)[source]
Bases:
synapse.lib.cli.Cmd
Manages cron jobs in a cortex.
Cron jobs are rules persistently stored in a cortex such that storm queries automatically run on a time schedule.
Cron jobs may be be recurring or one-time. Use the ‘at’ command to add one-time jobs.
A subcommand is required. Use ‘cron -h’ for more detailed help.
synapse.cmds.hive module
- class synapse.cmds.hive.HiveCmd(cli, **opts)[source]
Bases:
synapse.lib.cli.Cmd
Manipulates values in a cell’s Hive.
A Hive is a hierarchy persistent storage mechanism typically used for configuration data.
synapse.cmds.trigger module
- class synapse.cmds.trigger.Trigger(cli, **opts)[source]
Bases:
synapse.lib.cli.Cmd
Manipulate triggers in a cortex.
Triggers are rules persistently stored in a cortex such that storm queries automatically run when a particular event happens.
A subcommand is required. Use trigger -h for more detailed help.