### Install Fabric Plugins Source: https://github.com/blackstork-io/fabric/blob/main/docs/install.md Illustrates the process of installing Fabric plugins using the `install` sub-command after configuring the plugin dependencies. It shows example output of the installation process. ```text $ ./fabric install Mar 11 19:20:09.085 INF Searching plugin name=blackstork/elastic constraints=">=v0.0.1" Mar 11 19:20:09.522 INF Installing plugin name=blackstork/elastic version=0.4.0 Mar 11 19:20:10.769 INF Searching plugin name=blackstork/openai constraints=">=v0.0.1" Mar 11 19:20:10.787 INF Installing plugin name=blackstork/openai version=0.4.0 $ ``` -------------------------------- ### Install Fabric Plugins Source: https://github.com/blackstork-io/fabric/blob/main/docs/tutorial.md Command to install all required Fabric plugins, including the blackstork/openai plugin. ```shell $ fabric install Mar 11 19:20:10.769 INF Searching plugin name=blackstork/openai constraints=">=v0.4.0" Mar 11 19:20:10.787 INF Installing plugin name=blackstork/openai version=0.4.0 $ ``` -------------------------------- ### Install Fabric from GitHub Releases (macOS arm64) Source: https://github.com/blackstork-io/fabric/blob/main/README.md Provides a step-by-step guide to manually install Fabric on macOS (arm64) by downloading a release archive from GitHub. It includes creating a directory, downloading the tarball, unpacking it, and verifying the installation. ```bash # Create a folder mkdir fabric-bin # Download the latest release of Fabric wget https://github.com/blackstork-io/fabric/releases/latest/download/fabric_darwin_arm64.tar.gz -O ./fabric_darwin_arm64.tar.gz # Unpack Fabric release archive into `fabric-bin` folder tar -xvzf ./fabric_darwin_arm64.tar.gz -C ./fabric-bin # Verify that `fabric` runs ./fabric-bin/fabric --help ``` -------------------------------- ### Install Fabric from GitHub Releases (macOS arm64) Source: https://github.com/blackstork-io/fabric/blob/main/docs/install.md Provides a step-by-step guide to download, unpack, and verify the Fabric installation from GitHub releases for macOS arm64 architecture. ```bash # Create a folder mkdir fabric-bin # Download the latest release of Fabric wget https://github.com/blackstork-io/fabric/releases/latest/download/fabric_darwin_arm64.tar.gz -O ./fabric_darwin_arm64.tar.gz # Unpack Fabric release archive into `fabric-bin` folder tar -xvzf ./fabric_darwin_arm64.tar.gz -C ./fabric-bin # Verify that `fabric` runs ./fabric-bin/fabric --help ``` -------------------------------- ### Install blackstork/crowdstrike Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/crowdstrike/data-sources/falcon_discover_host_details.md Demonstrates how to install the `blackstork/crowdstrike` plugin by specifying its version in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/crowdstrike" = ">= v0.4.2" } } ``` -------------------------------- ### Example Rendered HTML Output Source: https://github.com/blackstork-io/fabric/blob/main/docs/tutorial.md An example of the HTML content generated by Fabric after rendering and publishing a document. ```html The Greeting

The Greeting

Hello, Fabric!

There are 8 planets and 146 moons in our solar system.

Neptune is the eighth and most distant planet in our solar system, located about 4.5 billion kilometers away from the Sun.

``` -------------------------------- ### Install blackstork/openai Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/openai/content-providers/openai_text.md Shows how to install the `blackstork/openai` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/openai" = ">= v0.4.2" } } ``` -------------------------------- ### Install Fabric using Homebrew Source: https://github.com/blackstork-io/fabric/blob/main/README.md Installs the Fabric CLI tool on macOS using Homebrew. It first adds the necessary tap and then installs the fabric package. Includes a command to verify the installed version. ```bash # Install Fabric from the tap brew install blackstork-io/tools/fabric # Verify the version installed fabric --version ``` -------------------------------- ### Example Global Fabric Configuration Source: https://github.com/blackstork-io/fabric/blob/main/docs/language/configs.md An example demonstrating the global Fabric configuration, including cache directory, plugin registry mirror, and specific plugin versions. ```hcl fabric { cache_dir = "./.fabric" plugins_registry { mirror_dir = "/tmp/local-mirror/plugins" } plugin_versions = { "blackstork/elastic" = "1.2.3" "blackstork/openai" = "=11.22.33" } } ``` -------------------------------- ### Install sqlite Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/sqlite/data-sources/sqlite.md Demonstrates how to install the `blackstork/sqlite` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/sqlite" = ">= v0.4.2" } } ``` -------------------------------- ### Install blackstork/microsoft Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/microsoft/content-providers/azure_openai_text.md Instructions on how to install the `blackstork/microsoft` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/microsoft" = ">= v0.4.2" } } ``` -------------------------------- ### Fabric Content Block Example Source: https://github.com/blackstork-io/fabric/blob/main/docs/language/content-blocks.md Provides a practical example of using Fabric content blocks, including configuration, local variables, and rendering text content using different providers (generic 'text' and 'openai_text'). ```hcl config content openai_text "test_account" { # Reading a key from an environment variable api_key = env.OPENAI_API_KEY } document "test-doc" { vars { items = ["aaa", "bbb", "ccc"] } content text { # Query contains a JQ query executed against the context local_var = query_jq(".vars.items | length") # The context can be accessed in Go templates value = "There are {{ .vars.local }} items: {{ .vars.items | toPrettyJson }}" } content openai_text { config = config.content.openai_text.test_account prompt = <<-EOT Write a short story, just a paragraph, about space exploration using the values from the provided items list as character names: {{ .vars.items | toPrettyJson }} EOT } } ``` ```text There are 3 items: [ "aaa", "bbb", "ccc" ] In the vast expanse of outer space, aaa, bbb, and ccc embarked on a daring mission of exploration. Their spaceship soared through the galaxies, encountering unknown planets and celestial bodies. With aaa's courage leading the way, bbb's wisdom guiding their decisions, and ccc's ingenuity solving the complex challenges they faced, the trio delved deeper into the mysteries of the cosmos. Together, they pushed the boundaries of what was thought possible, and with each discovery, their bond grew stronger. In the endless sea of stars, they found not only the wonders of the universe but also the strength of their friendship. ``` -------------------------------- ### Example Plugin Configuration (Go) Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/_index.md Illustrates how a plugin might be defined or referenced within a Go project's configuration. This example shows a typical plugin name format including namespace and short name. ```go package main import ( "fmt" "github.com/blackstork-io/fabric/plugin" ) func main() { // Example of referencing a plugin, e.g., Elasticsearch pluginName := "blackstork/elastic" fmt.Printf("Loading plugin: %s\n", pluginName) // In a real scenario, you would register and use the plugin here // plugin.Register(pluginName, &elastic.Plugin{}) } ``` -------------------------------- ### Example Render Output Source: https://github.com/blackstork-io/fabric/blob/main/docs/tutorial.md Illustrates the expected output when rendering the 'greeting' document, showing the rendered text and OpenAI-generated content. ```bash $ OPENAI_API_KEY="" ./fabric render document.greeting fabric render document.greeting Jun 23 17:14:23.910 INF Parsing fabric files command=render Jun 23 17:14:23.912 INF Loading plugin resolver command=render includeRemote=false Jun 23 17:14:23.912 INF Loading plugin runner command=render Jun 23 17:14:23.939 INF Rendering content command=render target=greeting Jun 23 17:14:23.939 INF Loading document command=render target=greeting # The Greeting Hello, Fabric! There are 8 planets and 146 moons in our solar system. Neptune is the eighth and farthest known planet from the Sun in the Solar System. It is classified as an ice giant and is the fourth-largest planet by diameter. ``` -------------------------------- ### Install blackstork/misp Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/misp/publishers/misp_event_reports.md Demonstrates how to install the `blackstork/misp` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/misp" = ">= v0.4.2" } } ``` -------------------------------- ### Basic Fabric Plugin in Go Source: https://github.com/blackstork-io/fabric/blob/main/examples/plugins/README.md Demonstrates how to create a simple Fabric plugin using the Go programming language. This example covers the fundamental structure and requirements for a basic plugin. ```Go package main import ( "fmt" "github.com/blackstork-io/fabric/pkg/plugin" ) // BasicPlugin is a simple example plugin. type BasicPlugin struct { plugin.Base } // NewBasicPlugin creates a new instance of BasicPlugin. func NewBasicPlugin() plugin.Plugin { return &BasicPlugin{} } func (p *BasicPlugin) Start() error { fmt.Println("BasicPlugin started") return nil } func (p *BasicPlugin) Stop() error { fmt.Println("BasicPlugin stopped") return nil } func main() { plugin.Serve(NewBasicPlugin) } ``` -------------------------------- ### Install blackstork/iris Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/iris/data-sources/iris_cases.md Instructions on how to install the `blackstork/iris` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/iris" = ">= v0.4.2" } } ``` -------------------------------- ### Install blackstork/microsoft Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/microsoft/_index.md Demonstrates how to install the blackstork/microsoft plugin by adding it to the `plugin_versions` map in the Fabric global configuration. This ensures compatibility with specific plugin versions. ```hcl fabric { plugin_versions = { "blackstork/microsoft" = ">= v0.4.2" } } ``` -------------------------------- ### Install blackstork/microsoft Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/microsoft/data-sources/microsoft_security_query.md Instructions on how to install the blackstork/microsoft plugin by adding its version to the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/microsoft" = ">= v0.4.2" } } ``` -------------------------------- ### Run Fabric with Docker Source: https://github.com/blackstork-io/fabric/blob/main/docs/install.md Demonstrates how to run the Fabric Docker image. It specifies the image name for Docker Hub. ```docker docker run blackstorkio/fabric ``` -------------------------------- ### Configure Fabric Plugins Source: https://github.com/blackstork-io/fabric/blob/main/docs/install.md Shows how to configure Fabric to install specific plugins by defining their dependencies in the global configuration file using HCL syntax. ```hcl fabric { plugin_versions = { "blackstork/openai" = ">= 0.0.1", "blackstork/elastic" = ">= 0.0.1", } } ``` -------------------------------- ### Install `blackstork/github` Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/github/publishers/github_gist.md Shows how to add the `blackstork/github` plugin to the Fabric global configuration by specifying its version in the `plugin_versions` map. ```hcl fabric { plugin_versions = { "blackstork/github" = ">= v0.4.2" } } ``` -------------------------------- ### Install blackstork/microsoft Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/microsoft/data-sources/microsoft_graph.md Instructions on how to install the `blackstork/microsoft` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/microsoft" = ">= v0.4.2" } } ``` -------------------------------- ### Install Fabric Plugins Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/_index.md Automatically download and install required plugins for Fabric. This command simplifies the process of setting up external integrations for data sources and content providers. ```bash fabric install ``` -------------------------------- ### Install graphql data source plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/graphql/data-sources/graphql.md This snippet shows how to install the `blackstork/graphql` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/graphql" = ">= v0.4.2" } } ``` -------------------------------- ### Fabric Document Publish Configuration Example Source: https://github.com/blackstork-io/fabric/blob/main/docs/language/publish-blocks.md An HCL example defining a Fabric document with two 'local_file' publish destinations, one for PDF and one for HTML, with dynamic path generation. ```hcl document "foo" { publish local_file { path = "docs/foo_{{ now | date \"2006_01_02\" }}.{{.format}}" format = "pdf" } publish local_file { path = "html/foo-latest.{{.format}}" format = "html" } title = "Test Document" content text { value = "Static text in the document body" } } ``` -------------------------------- ### Fabric CLI Core Commands Overview Source: https://github.com/blackstork-io/fabric/blob/main/docs/cli.md An overview of the main commands available in the Fabric CLI: 'install' for plugins, 'data' for executing data blocks, and 'render' for document templating. ```go package main import "fmt" func main() { fmt.Println("Fabric CLI") // Commands: // install: installs all required plugins // data: executes the data block and prints out prettified JSON // render: renders the specified target (a document template) } ``` -------------------------------- ### FCL Argument Example Source: https://github.com/blackstork-io/fabric/blob/main/docs/language/syntax.md Demonstrates the basic structure of an argument in FCL, which is used for assigning values to names within a block. Argument names can include letters, digits, underscores, and hyphens, but must not start with a digit. ```hcl content text { value = "An example of the text value" } ``` -------------------------------- ### Install Fabric with Homebrew Source: https://github.com/blackstork-io/fabric/blob/main/docs/install.md Installs Fabric using Homebrew on macOS. It includes commands to tap the repository and verify the installation. ```bash # Install Fabric from the tap brew install blackstork-io/tools/fabric # Verify the version installed fabric --version ``` -------------------------------- ### Fabric Render Execution Examples Source: https://github.com/blackstork-io/fabric/blob/main/docs/language/publish-blocks.md Demonstrates different ways to execute the 'fabric render' command, including specifying output format and enabling the publish flag. ```bash $ fabric render document.example --format md # Hello World Document body ``` ```bash $ fabric render document.example --format html Hello World

Hell World

Document body

% ``` ```bash $ fabric render document.example --publish Jun 2 12:48:08.899 INF Writing to a file path=/tmp/example_2024_06_02.pdf Jun 2 12:48:09.182 INF Writing to a file path=/tmp/example_2024_06_02.html Jun 2 12:48:09.183 INF Writing to a file path=/tmp/example_2024_06_02.md ``` -------------------------------- ### Render and Publish Document via CLI Source: https://github.com/blackstork-io/fabric/blob/main/docs/tutorial.md Demonstrates how to use the `fabric render` command with the `--publish` flag to render a specific document and publish its output to the configured destination. ```bash $ fabric render document.greeting --publish Jun 23 17:28:03.027 INF Parsing fabric files command=render Jun 23 17:28:03.028 INF Loading plugin resolver command=render includeRemote=false Jun 23 17:28:03.028 INF Loading plugin runner command=render Jun 23 17:28:03.056 INF Publishing document command=render target=greeting Jun 23 17:28:03.056 INF Loading document command=render target=greeting Jun 23 17:28:04.213 INF Writing to a file command=render path=/tmp/greeting-2024_06_23.html $ ``` -------------------------------- ### Rendering a Fabric Document Source: https://github.com/blackstork-io/fabric/blob/main/docs/tutorial.md Command to render a Fabric document named 'greeting', requiring the OpenAI API key to be set in the environment. ```shell $ OPENAI_API_KEY="" fabric render document.greeting ``` -------------------------------- ### Install blackstork/microsoft Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/microsoft/data-sources/microsoft_sentinel_incidents.md Demonstrates how to install the `blackstork/microsoft` plugin by specifying its version in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/microsoft" = ">= v0.4.2" } } ``` -------------------------------- ### Fabric Render Command Help Source: https://github.com/blackstork-io/fabric/blob/main/docs/language/publish-blocks.md Displays help information for the 'fabric render' command, outlining its usage, arguments, and flags for rendering and publishing documents. ```bash $ fabric render --help Render the specified document and either publish it or output it as Markdown to stdout. Usage: fabric render TARGET [flags] Args: TARGET name of the document to be rendered as 'document.' Flags: --format string default output format of the document (md, html or pdf) (default "md") -h, --help help for render --publish publish the rendered document Global Flags: --color enables colorizing the logs and diagnostics (if supported by the terminal and log format) (default true) --log-format string format of the logs (plain or json) (default "plain") --log-level string logging level ('debug', 'info', 'warn', 'error') (default "info") --source-dir string a path to a directory with *.fabric files (default ".") -v, --verbose a shortcut to --log-level debug ``` -------------------------------- ### Install blackstork/iris Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/iris/data-sources/iris_alerts.md Instructions on how to install the `blackstork/iris` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/iris" = ">= v0.4.2" } } ``` -------------------------------- ### Fabric CLI Help Output Source: https://github.com/blackstork-io/fabric/blob/main/README.md Displays the available commands and flags for the Fabric CLI, providing a quick reference for users. ```text Usage: fabric [command] Available Commands: completion Generate the autocompletion script for the specified shell data Execute a single data block help Help about any command install Install plugins render Render the document Flags: --color enables colorizing the logs and diagnostics (if supported by the terminal and log format) (default true) -h, --help help for fabric --log-format string format of the logs (plain or json) (default "plain") --log-level string logging level ('debug', 'info', 'warn', 'error') (default "info") --source-dir string a path to a directory with *.fabric files (default ".") -v, --verbose a shortcut to --log-level debug --version version for fabric Use "fabric [command] --help" for more information about a command. ``` -------------------------------- ### Install Crowdstrike Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/crowdstrike/data-sources/falcon_detection_details.md Instructions on how to install the `blackstork/crowdstrike` plugin by adding its version to the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/crowdstrike" = ">= v0.4.2" } } ``` -------------------------------- ### Document with OpenAI Content using JQ and Prompt Templating Source: https://github.com/blackstork-io/fabric/blob/main/docs/tutorial.md Defines a document that uses the OpenAI content provider, fetching data with JQ and using a prompt template to generate a fact about a planet. ```hcl document "greeting" { vars { solar_system = { planets = [ "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" ] moons_count = 146 } } content openai_text { local_var = query_jq("{planet: .vars.solar_system.planets[-1]}") prompt = <<-EOT Share a fact about the planet specified in the provided data: {{ .vars.local | toRawJson }} EOT } } ``` -------------------------------- ### Install splunk_search Data Source Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/splunk/data-sources/splunk_search.md Demonstrates how to install the blackstork/splunk plugin by adding it to the fabric plugin_versions configuration. ```hcl fabric { plugin_versions = { "blackstork/splunk" = ">= v0.4.2" } } ``` -------------------------------- ### Install blackstork/github Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/github/data-sources/github_issues.md Instructions on how to install the 'blackstork/github' plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/github" = ">= v0.4.2" } } ``` -------------------------------- ### Basic Fabric Template Source: https://github.com/blackstork-io/fabric/blob/main/docs/tutorial.md Defines a simple Fabric document template with a static text content block. This serves as a basic example to confirm correct configuration. ```hcl document "greeting" { content text { value = "Hello, Fabric!" } } ``` -------------------------------- ### Install blackstork/nist_nvd Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/nist_nvd/data-sources/nist_nvd_cves.md Instructions on how to install the 'blackstork/nist_nvd' plugin by adding its version to the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/nist_nvd" = ">= v0.4.2" } } ``` -------------------------------- ### Install blackstork/misp Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/misp/data-sources/misp_events.md Instructions on how to install the `blackstork/misp` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/misp" = ">= v0.4.2" } } ``` -------------------------------- ### Install Blackstork Crowdstrike Plugin Source: https://github.com/blackstork-io/fabric/blob/main/docs/plugins/crowdstrike/data-sources/falcon_intel_indicators.md Instructions on how to install the `blackstork/crowdstrike` plugin by adding it to the `plugin_versions` map in the Fabric global configuration. ```hcl fabric { plugin_versions = { "blackstork/crowdstrike" = ">= v0.4.2" } } ```