Skip to content

Commit 9c410c1

Browse files
committed
Tweaks
1 parent f60f60a commit 9c410c1

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

bin/generate-descriptions.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* async fetch(request, env): Promise<Response> {
2323
* const response = await env.AI.run("@cf/facebook/bart-large-cnn", {
2424
* input_text: await request.text(),
25-
* max_length: 160
25+
* max_length: 120
2626
* });
2727
* return Response.json(response.summary);
2828
* },
@@ -63,15 +63,21 @@ async function generateDescriptionFromAPI(
6363
}
6464

6565
const description = await response.text();
66-
// Remove surrounding quotes if they exist
67-
const trimmed = description.trim();
66+
// Remove surrounding quotes and all square brackets
67+
let trimmed = description.trim();
68+
69+
// Remove surrounding quotes
6870
if (
6971
(trimmed.startsWith('"') && trimmed.endsWith('"')) ||
7072
(trimmed.startsWith("'") && trimmed.endsWith("'"))
7173
) {
72-
return trimmed.slice(1, -1);
74+
trimmed = trimmed.slice(1, -1);
7375
}
74-
return trimmed;
76+
77+
// Remove all square brackets from the text
78+
trimmed = trimmed.replace(/\[|\]/g, '');
79+
80+
return trimmed.trim();
7581
} catch (error) {
7682
console.error("Error calling localhost API:", error);
7783
return undefined;

src/content/docs/analytics/analytics-integrations/splunk.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Splunk
44
sidebar:
55
order: 104
66
description: >-
7-
This tutorial explains how to analyze [Cloudflare Logs] using the Cloudflare App for Splunk. Prerequisites: Have an existing Splunk Enterprise or Cloud account. Consult the [Splunk documentation] for more information.
7+
This tutorial explains how to analyze Cloudflare Logs using the Cloudflare App for Splunk.
88
---
99

1010
import { Render } from "~/components";
@@ -32,20 +32,17 @@ To install the [Cloudflare App for Splunk](https://splunkbase.splunk.com/app/450
3232
4. Restart and reopen your Splunk instance.
3333

3434
5. Edit the `cloudflare:json` source type in the Cloudflare App for Splunk. To edit the source type:
35-
3635
1. Click the **Settings** dropdown and select **Source types**.
3736
2. Uncheck **Show only popular** and search for _cloudflare_.
3837
3. Click **Edit** and change the Regex expression to `([\r\n]+)`.
3938
4. Save your edits.
4039

4140
6. Create an index on Splunk to store the HTTP Event logs. To create an index:
42-
4341
1. Open the setup screen by clicking the **Settings** dropdown, then click **Indexes**.
4442
2. Select **New Index**. Note that the **Indexes** page also gives you the status of all your existing indexes so that you can see whether you're about to use up your licensed amount of space.
4543
3. Name the index **cloudflare**, which is the default index that the Cloudflare App will use.
4644

4745
7. Set up the HTTP Event Collector (HEC) on Splunk. To create an HEC:
48-
4946
1. Click the **Settings** dropdown and select **Data inputs**.
5047
2. Click **+Add new** and follow the wizard. When prompted, submit the following responses:
5148
- Name: Cloudflare

0 commit comments

Comments
 (0)