steampipe plugin install mastodon

Mastodon + Steampipe

Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.

Mastodon is a federated social network similar to Twitter.

For example:

query = 'twitter';
| created_at | username | content |
| 2023-01-19T15:08:14-03:00 | arinbasu1 | But the point is #Mastodon is not a replacement of Twitter anyway. |
| 2023-02-05T22:13:11-03:00 | ancient_catbus | i didn't know the grammys were on until I opened twitter |


Quick start


Download and install the latest Mastodon plugin:

steampipe plugin install mastodon


CredentialsAll API requests require a Mastodon Access Token.
PermissionsAPI tokens have the same permissions as the user who creates them, and if the user permissions change, the API token permissions also change.
RadiusEach connection represents a single Mastodon installation.
Resolution1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/mastodon.spc)


Installing the latest mastodon plugin will create a config file (~/.steampipe/config/mastodon.spc) with a single connection named mastodon:

connection "mastodon" {
plugin = "mastodon"
# `server` (required) - The federated server your account lives. Ex: mastodon.social, nerdculture.de, etc
# server = "https://myserver.social"
# `access_token` (required) - Get your access token by going to your Mastodon server, then: Settings -> Development -> New Application
# Refer to this page for more details: https://docs.joinmastodon.org/client/token
# access_token = "FK1_gBrl7b9sPOSADhx61-uvagzv9EDuMrXuc1AlcNU"
# `app` (optional) - Allows you to follow links to Elk instead of stock client
# app = "elk.zone"
# `max_toots` (optional) - Defines the maximum number of toots to list in the mastodon toot tables.
# If not set, the default is 1000. To avoid limiting, set max_toots = -1
# max_toots = 1000
  • access_token - The token to access the Mastodon APIs. This is required while querying all the tables except mastodon_rule, mastodon_peer, mastodon_server, mastodon_weekly_activity, and mastodon_domain_block tables.

Postgres FDW

This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- mastodon

The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.

To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.

CREATE EXTENSION IF NOT EXISTS steampipe_postgres_mastodon;
CREATE SERVER steampipe_mastodon FOREIGN DATA WRAPPER steampipe_postgres_mastodon OPTIONS (config '<your_config>');
IMPORT FOREIGN SCHEMA mastodon FROM SERVER steampipe_mastodon INTO mastodon;

SQLite Extension

This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- mastodon

The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.

To configure the SQLite extension, load the extension module and then run the steampipe_configure_mastodon function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_mastodon.so
sqlite> select steampipe_configure_mastodon('<your_config>');


This plugin is available as a standalone Export CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- mastodon

You can pass the configuration to the command with the --config argument:

steampipe_export_mastodon --config '<your_config>' <table_name>