<@U04S8PLJWMT> how to extract metadata of an Airby...
# ask-ai
t
@kapa.ai how to extract metadata of an Airbyte sync? eg Number of records synced for each stream from each Airbyte sync
k
To extract metadata such as the number of records synced for each stream from each Airbyte sync, you can use the following approaches based on the Airbyte UI and available features: ### 1. Airbyte UI: Connection Timeline & Status Page Airbyte provides detailed sync metadata in the Connection Timeline and Connection Status pages. For each sync (including refreshes and clears), you can view: - The number of records read (extracted) from the source for each stream. - The number of records loaded (committed) to the destination for each stream. - The total amount of data moved. - The sync duration. This information is displayed per stream and per sync, helping you monitor and troubleshoot your data pipelines. The UI shows these metrics for each sync event, and you can review them for historical syncs as well. This is available in Airbyte Cloud, Cloud Teams, and Self-Managed Enterprise editions. Example metrics shown: -
x
extracted records: Number of records read from the source during the sync. -
x
loaded records: Number of records the destination confirmed it received. - Sync duration and data volume moved. > Users can now monitor the incremental progress of syncs on the Connection Status page. The sync progress feature displays record counts and sync duration for each stream during a sync, as well as which streams are syncing and when a connection sync is actively running. The Connection Status Page also now shows counts from the last time each enabled stream synced. Lastly, each stream individually displays stream status, which helps users troubleshoot by indicating exactly which streams are erroring. [June 2024 Release Notes](https://docs.airbyte.com/release_notes/june_2024) > For sync and refresh events, Airbyte also shows the volume of synced data, such as the amount of data moved, the number of records read and committed, and the total sync time. Reviewing this timeline can help you monitor the connection and identify any potential issues. [Review the Connection Timeline](https://docs.airbyte.com/platform/next/cloud/managing-airbyte-cloud/review-connection-timeline#syncs-refreshes-and-clears) ### 2. Programmatic Access (APIs, Logs, or Metrics) While the knowledge sources do not provide explicit API endpoints for extracting this metadata programmatically, Airbyte does expose metrics (in Self-Managed Enterprise) via OpenTelemetry, which can be sent to your monitoring system. These metrics include: - `airbyte.syncs`: Sync status and metadata. - `airbyte.gb_moved`: Data volume moved. - `airbyte.sync_duration`: Sync duration. These metrics are tagged with connection ID, job ID, stream, and other identifiers, allowing you to break down the data per stream and per sync if you collect and analyze these metrics in your monitoring tool. > Airbyte Self-Managed Enterprise generates a number of crucial metrics about syncs and volumes of data moved. You can configure Airbyte to send telemetry data to an OpenTelemetry collector endpoint so you can consume these metrics in your downstream monitoring tool of choice. [OpenTelemetry metrics monitoring](https://docs.airbyte.com/platform/operator-guides/collecting-metrics#otel) --- Summary: - Use the Airbyte UI (Connection Timeline/Status Page) to view per-stream, per-sync record counts and other metadata. - For programmatic access, leverage OpenTelemetry metrics in Self-Managed Enterprise, or consult Airbyte logs for detailed sync statistics. If you need to extract this data outside the UI and are not using Self-Managed Enterprise, the knowledge sources do not provide enough information about direct API endpoints for this purpose.
t
@kapa.ai I want to use Airbyte provided APIs to extract those? How to?
k
A message from kapa.ai
To extract sync metadata (such as the number of records synced for each stream) using Airbyte APIs, you can use the Airbyte Jobs API to fetch job (sync) history for a specific connection. Here’s how you can do it based on the available knowledge sources: ### 1. Fetch Sync Job History You can use the
/v1/jobs/list
API endpoint to fetch all jobs (including sync jobs) for a specific connection. The
configId
parameter in the request body is the
connectionId
of your Airbyte connection. Example request:
Copy code
json POST /v1/jobs/list {   "configTypes": ["sync"],   "configId": "<your-connection-id>",   "pagination": {     "pageSize": 10,     "rowOffset": 0   } }
This will return a list of sync jobs for the specified connection. [Forum reference](https://discuss.airbyte.io/t/2235) ### 2. Extracting Per-Stream Metadata The knowledge sources do not explicitly state that the API response includes per-stream record counts (such as records extracted/loaded per stream). The API will provide job-level information, but detailed per-stream sync statistics may not be directly available via the public API response. ### 3. Limitations - The knowledge sources confirm you can retrieve job (sync) history via the API, but do not confirm that you can get per-stream record counts directly from the API response. - For more granular per-stream metrics, you may need to rely on the Airbyte UI or logs, as described previously. --- Summary: - Use the
/v1/jobs/list
API to fetch sync job history for a connection. - The API provides job-level details, but the knowledge sources do not confirm that per-stream record counts are available via the API. - For detailed per-stream sync metadata, you may need to use the Airbyte UI or logs. If you need more granular data and it is not present in the API response, the knowledge sources do not provide enough information to confirm that this is possible via the current Airbyte API. [Forum reference](https://discuss.airbyte.io/t/2235)
t
@kapa.ai how to extract the logs of the sync daily?
k
A message from kapa.ai
To extract the logs of an Airbyte sync daily, you can automate the process using the Airbyte UI or by accessing the logs directly from the file system (for Airbyte Open Source deployments). ### 1. Download Logs via the Airbyte UI You can manually download logs for each sync from the Airbyte UI: - Go to your connection's Job History tab. - Click the three grey dots next to a sync and select Download logs. - This will download the logs for that sync attempt. If a sync was completed across multiple attempts, the download will include logs from all attempts for that job. You can repeat this process daily for each new sync, or automate it using the methods below if you need a programmatic solution [Browsing logs](https://docs.airbyte.com/platform/operator-guides/browsing-output-logs). ### 2. Extract Logs from Docker Volumes (Open Source) For Airbyte Open Source, logs are stored in Docker volumes. You can automate extraction using a script and Docker commands. For example, to access logs for a specific sync attempt:
Copy code
bash docker run -it --rm --volume airbyte_workspace:/data busybox cat /data/<job-id>/<attempt-id>/logs.log
Or, to copy the log file to your host machine:
Copy code
bash docker cp airbyte-server:/tmp/workspace/<job-id>/<attempt-id>/logs.log .
You can schedule this command to run daily (e.g., using a cron job) to extract the latest logs [Exploring Local Logs](https://docs.airbyte.com/platform/operator-guides/browsing-output-logs#exploring-local-logs). ### 3. Automate with API (If Available) The knowledge sources do not confirm a direct API endpoint for downloading logs, but you can use the Jobs API to list recent jobs and then use the above Docker commands to extract logs for those jobs. --- Summary: - Use the Airbyte UI to manually download logs. - For Open Source, automate extraction from Docker volumes using shell scripts and Docker commands. - Schedule your extraction process (e.g., with cron) to run daily. If you need a fully automated, API-based log download, the knowledge sources do not provide enough information to confirm this is currently possible.
t
@kapa.ai I use Airbyte Cloud, how to programatically extract the logs?
k
A message from kapa.ai
I'm sorry, but the knowledge sources do not provide information about a programmatic way to extract sync logs from Airbyte Cloud. The documentation only describes how to download logs manually via the Airbyte UI by selecting the three grey dots next to a sync and choosing "Download logs" or "View logs" in the in-app log viewer. There is no mention of an API or automated method for downloading logs from Airbyte Cloud in the provided sources [Browsing logs](https://docs.airbyte.com/platform/operator-guides/browsing-output-logs). If you require programmatic access to logs in Airbyte Cloud, you may need to contact Airbyte support for further guidance, as this capability is not documented in the available knowledge sources.