---
source_url: https://www.pubnub.com/docs/message-processing/serverless/export-logs
title: Export Functions logs
description: Export PubNub Functions log output to a Webhook or S3 bucket using Events & Actions.
updated_at: 2026-11-17T13:11:46.000Z
---

# Export Functions logs

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

Functions publish log output to an internal PubNub channel. To keep that output after the console session ends, use [Events & Actions](https://www.pubnub.com/docs/integrations/event-forwarding/overview.md) to forward it to a Webhook endpoint or an S3 bucket.

## Before you start

Before starting, confirm you have:

* A deployed Function. If you do not have one, see [Create a Function](https://www.pubnub.com/docs/message-processing/serverless/create-function.md).
* The log channel name for your Function revision. It follows the pattern `output-rev-{{functionRevisionId}}-key-{{keysetId}}`, for example `output-rev-00000000-0000-4000-8000-000000000000-key-123456`, where the revision ID is a UUID and the keyset ID is a number. Find the exact name in the Console output.

A Function replica publishes up to 250 console log lines over its lifetime, not per execution, and output stops silently once a replica reaches that budget.

## Configure the event listener

1. In the Admin Portal, open [Events & Actions](https://admin.pubnub.com) and [configure an event listener](https://www.pubnub.com/docs/integrations/event-forwarding/configure.md) on the log channel.
2. Enter the `output-rev-*` channel name from the Console output in the **Condition value** field.

   ![Event listener configured on the Functions log channel](https://www.pubnub.com/assets/images/event-listener-logs-da5def629104b11177bce64617dedc55.png)

## Create the export action

1. Create a [Webhook](https://www.pubnub.com/docs/integrations/event-forwarding/create-webhook-action.md) or [S3](https://www.pubnub.com/docs/integrations/event-forwarding/create-s3-action.md) action.
2. Attach the event listener you created in the previous section to the action.
3. To send multiple log events in one request, enable batching on the action.

Events & Actions now forwards log output to your destination each time the Function publishes to the log channel.

## Sort the exported lines

Every line from one invocation of your Function carries the same `executionId`, and each line carries a `sequenceId`. To read one invocation's lines in the order your Function logged them:

1. Group the lines by `executionId`.
2. Sort each group by `sequenceId`.
3. Keep lines without an `executionId` in a group of their own. The runtime publishes some lines, such as those logged outside an invocation, without one.

Don't order lines by their [timetoken](https://www.pubnub.com/docs/architecture/core-concepts.md#timetoken). The timetoken records when PubNub received a line, and `sequenceId` records the order your Function logged it. For each field, see [Function log lines](https://www.pubnub.com/docs/integrations/event-forwarding/payloads.md#function-log-lines) in the Events & Actions payloads reference.

[Live delivery](https://www.pubnub.com/docs/architecture/data-transport-and-delivery.md#live-delivery-and-gap-recovery) replays short gaps automatically, but a line can be missed during a longer gap. See [Data transport and delivery](https://www.pubnub.com/docs/architecture/data-transport-and-delivery.md). A gap in `sequenceId` is normal and doesn't mean a line was lost, because the counter also advances for calls that are filtered out before publishing.

If you need an order of your own, log a marker or an identifier of your own and sort by that.

Last updated at: 2026-11-17T13:11:46.000Z
