Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b13ce7d
WIP
kirkrodrigues Jan 20, 2025
72398d8
WIP
kirkrodrigues Jan 20, 2025
9f620b8
WIP
kirkrodrigues Jan 20, 2025
2bd546f
Update guides-using-object-storage.md
kirkrodrigues Jan 20, 2025
a298676
WIP
kirkrodrigues Jan 21, 2025
f1a40e8
Merge branch 'main' into s3-docs
kirkrodrigues Jan 21, 2025
4ea2018
Add details about configuring an IAM user; Fix config keys; General r…
kirkrodrigues Jan 21, 2025
19e01c3
draft
haiqi96 Jan 21, 2025
542cba2
Add prerequisites section; Move AWS user setup into prerequisites; Fi…
kirkrodrigues Jan 22, 2025
22feafb
Split docs into their own pages to reduce cognitive load.
kirkrodrigues Jan 22, 2025
baeffb1
Move object storage compression tip.
kirkrodrigues Jan 22, 2025
b95b45f
Touch-ups.
kirkrodrigues Jan 22, 2025
c99bce3
Explain staging_directory.
kirkrodrigues Jan 22, 2025
bdcf423
Fix links.
kirkrodrigues Jan 22, 2025
82caf11
Apply the Rabbit's suggestions.
kirkrodrigues Jan 22, 2025
d7d2800
Remove misleading S3 path diagram; Add step for creating IAM user cre…
kirkrodrigues Jan 22, 2025
2f9ae7f
Change from 'viewing compressed logs' to 'caching stream files'.
kirkrodrigues Jan 22, 2025
90dbe51
Diction.
kirkrodrigues Jan 22, 2025
f6171e7
Fix S3 permissions for ingestion; Use virtual-host style URL; Clarify…
kirkrodrigues Jan 23, 2025
11e6991
Add timestamp-key to compression example.
kirkrodrigues Jan 23, 2025
9c4ee8a
Clarify key-prefix for ingestion.
kirkrodrigues Jan 23, 2025
59b72e9
Clarify the prefix of the prefix must be the prefix.
kirkrodrigues Jan 23, 2025
4ae7d43
Fix placement of timestamp key line.
kirkrodrigues Jan 23, 2025
847c042
Linebreak before s3 for clarity.
kirkrodrigues Jan 23, 2025
c752945
Clarify some instructions based on AWS' UI.
kirkrodrigues Jan 23, 2025
454cb87
Restructure to make docs easier to follow and use.
kirkrodrigues Jan 23, 2025
57690ea
Apply the rabbit's suggestions.
kirkrodrigues Jan 23, 2025
e1e4444
Mention that users need to be familiar with the quick start guide.
kirkrodrigues Jan 23, 2025
a57daaf
Apply suggestions from code review
kirkrodrigues Jan 24, 2025
73de4de
Fix indentation.
kirkrodrigues Jan 24, 2025
5808e0d
Marco review.
kirkrodrigues Jan 24, 2025
8e06c1a
Minor edit for consistency.
kirkrodrigues Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/src/user-guide/guides-overview.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider renaming this section from guides to object storage. Everything in user-guide is technically a guide. We could then renameUsing object storage to Using AWS S3.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our plan is actually to rename "User guide" to "User docs" and "Developer guide" to "Developer docs". Although technically everything is a guide, we do want to differentiate "guides" (tutorials) from reference docs. Technically we could also move the quick start section into the guides section, but I'd need to restructure it a little.

What do you think about moving in that direction instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I feel maybe the restructure can wait after we release the software to the intended user

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Overview

The guides below describe how to use CLP in different use cases.

::::{grid} 1 1 2 2
:gutter: 2

:::{grid-item-card}
:link: guides-using-object-storage/index
Using object storage
^^^
Using CLP to ingest logs from object storage and store archives on object storage.
:::
::::
69 changes: 69 additions & 0 deletions docs/src/user-guide/guides-using-object-storage/archive-storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Storing archives

To store compressed archives on S3, you'll need to:

1. Enable the CLP IAM user to access the S3 path where archives should be stored.
2. Configure CLP to store archives under the relevant S3 path.

## IAM user configuration

Attach the following policy to the CLP IAM user by following [this guide][add-iam-policy].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing link definition.

The link reference [add-iam-policy] is undefined.

Add the following link definition at the bottom of the file:

[add-iam-policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html#add-policies-console
🧰 Tools
🪛 Markdownlint (0.37.0)

10-10: Missing link or image reference definition: "add-iam-policy"
Reference links and images should use a label that is defined

(MD052, reference-links-images)


```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::<bucket-name>/<key-prefix>/*"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add trailing slash requirement to prevent unintended access.

The S3 resource pattern should explicitly mention that <key-prefix> must end with a trailing slash to prevent unintended access to resources with similar prefixes.

-      "arn:aws:s3:::<bucket-name>/<key-prefix>/*"
+      "arn:aws:s3:::<bucket-name>/<key-prefix>/*"  # <key-prefix> must end with '/'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"arn:aws:s3:::<bucket-name>/<key-prefix>/*"
"arn:aws:s3:::<bucket-name>/<key-prefix>/*" # <key-prefix> must end with '/'

]
}
]
}
```

Replace the fields in angle brackets (`<>`) with the appropriate values:

* `<bucket-name>` should be the name of the S3 bucket to store compressed archives.
* `<key-prefix>` should be the prefix where you want the compressed archives to be stored under.

## Configuring CLP's archive storage location

To configure CLP to store archives on S3, update the `archive_output.storage` key in
`<package>/etc/clp-config.yml`:

```yaml
archive_output:
storage:
type: "s3"
staging_directory: "var/data/staged-archives" # Or a path of your choosing
s3_config:
region_code: "<region-code>"
bucket: "<bucket-name>"
key_prefix: "<key-prefix>"
credentials:
access_key_id: "<aws-access-key-id>"
secret_access_key: "<aws-secret-access-key>"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add security and operational considerations.

The configuration section should include guidance on:

  1. Staging directory permissions and cleanup strategy
  2. Secure credential management
  3. Key prefix organization best practices

Add the following section after the configuration:

### Important considerations

* Staging directory:
  * Set restrictive permissions (readable/writable only by CLP user)
  * Implement periodic cleanup to prevent disk space issues
  * Monitor disk usage

* Credentials security:
  * Store credentials file with restricted permissions (600)
  * Rotate access keys regularly
  * Consider using AWS credential provider chain

* Key prefix best practices:
  * Use date-based organization (e.g., archives/YYYY/MM/)
  * Include environment identifiers
  * Always end with trailing slash


# archive_output's other config keys
```

Replace the fields in angle brackets (`<>`) with the appropriate values:

* `staging_directory` is the local filesystem directory where archives will be temporarily stored
before being uploaded to S3.
* `s3_config` configures both the S3 bucket where archives should be stored and the credentials
for accessing it.
* `<region-code>` is the AWS region [code][aws-region-codes] for the bucket.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing link definition.

The link reference [aws-region-codes] is undefined.

Add the following link definition at the bottom of the file:

[aws-region-codes]: https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints
🧰 Tools
🪛 Markdownlint (0.37.0)

60-60: Missing link or image reference definition: "aws-region-codes"
Reference links and images should use a label that is defined

(MD052, reference-links-images)

* `<bucket-name>` is the bucket's name.
* `<key-prefix>` is the "directory" where all archives will be stored within the bucket and
must end with trailing forward slash (e.g., `archives/`).
* `credentials` contains the CLP IAM user's credentials.

[add-iam-policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html#embed-inline-policy-console
[aws-region-codes]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html#Concepts.RegionsAndAvailabilityZones.Availability
82 changes: 82 additions & 0 deletions docs/src/user-guide/guides-using-object-storage/compress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Compressing logs

To compress logs from S3, you'll need to:

1. Enable the CLP IAM user to access the S3 path containing your logs.
2. Use the `s3` subcommand of `sbin/compress.sh` to compress your logs.

## IAM user configuration

Attach the following policy to the CLP IAM user by following [this guide][add-iam-policy].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing link definition.

The link reference [add-iam-policy] is undefined.

Add the following link definition at the bottom of the file:

[add-iam-policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html#add-policies-console
🧰 Tools
🪛 Markdownlint (0.37.0)

10-10: Missing link or image reference definition: "add-iam-policy"
Reference links and images should use a label that is defined

(MD052, reference-links-images)


```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": [
"arn:aws:s3:::<bucket-name>/<key-prefix>/*"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the other comment, if we go with option2, here should be:

Suggested change
"arn:aws:s3:::<bucket-name>/<key-prefix>/*"
"arn:aws:s3:::<bucket-name>/<key-prefix>*"

Note this will may give CLP unexpected permission if does not end with '/'

For example, if user only wants to compress /path/my_exp_logs/*. and they key in /path/my_exp_logs*.

Then, CLP will also have access to logs with path /path/my_exp_logs_no_body_should_access

]
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::<bucket-name>"
],
"Condition": {
"StringLike": {
"s3:prefix": "<key-prefix>/*"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

}
}
}
]
}
```

Replace the fields in angle brackets (`<>`) with the appropriate values:

* `<bucket-name>` should be the name of the S3 bucket containing your logs.
* `<key-prefix>` should be the prefix of all logs you wish to compress.

## Using `sbin/compress.sh s3`

You can use the `s3` subcommand as follows:

```bash
sbin/compress.sh s3 --aws-credentials-file <credentials-file> s3://<bucket-name>/<key-prefix>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per offline discussion, what we have here is inconsistent with the permission.

we can either:

  1. Change this line as suggested.
Suggested change
sbin/compress.sh s3 --aws-credentials-file <credentials-file> s3://<bucket-name>/<key-prefix>
sbin/compress.sh s3 --aws-credentials-file <credentials-file> s3://<bucket-name>/<key-prefix>/

2.: Change the permission as suggested

@haiqi96 haiqi96 Jan 22, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, s3://<bucket-name>/<key-prefix> wouldn't work since it does not specify the region of the bucket. (so we refuse to parse it and throw an exception)
It's possible to get the region of bucket, but that would require another permission to be add to IAM.

For now, we only accept either path-style URL or virtual-hosted–style URL.

One example is of host style URL is:

https://<bucket-name>.s3.<region-code>.amazonaws.com/<key-prefix>

According to https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html, path-style support will discontinue, so maybe we should give user the example using virtual-hosted–style URL.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added:

Do we also want to add --timestamp-key <key>?

```

* `<credentials-file>` is the path to an AWS credentials file like the following:

```ini
[default]
aws_access_key_id = <aws-access-key-id>
aws_secret_access_key = <aws-secret-access-key>
```

* CLP expects the credentials to be in the `default` section.
* `<aws-access-key-id>` and `<aws-secret-access-key>` are the access key ID and secret access
key of the CLP IAM user.
* If you don't want to use a credentials file, you can specify the credentials on the command
line using the `--aws-access-key-id` and `--aws-secret-access-key` flags (note that this may
expose your credentials to other users running on the system).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Strengthen security warning for command-line credentials.

The current warning about credential exposure should be more prominent and detailed.

Replace the current warning with:

:::{warning}
Specifying credentials via command-line arguments is strongly discouraged because:
* Credentials may be visible in process listings (ps, top, etc.)
* Credentials are stored in shell history
* Credentials may appear in system logs
* Other users on the system may see the credentials

Use a credentials file with appropriate file permissions (chmod 600) for better security.
:::


Comment on lines +54 to +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add AWS region configuration information

The credentials section should mention how to specify the AWS region.

Add this content after line 60:

  You can specify the AWS region in the credentials file:
  ```ini
  region = us-east-1

Alternatively, use the --aws-region flag on the command line.


<!-- This is an auto-generated comment by CodeRabbit -->

* `<bucket-name>` is the name of the S3 bucket containing your logs.
* `<key-prefix>` is the prefix of all logs you wish to compress.

@haiqi96 haiqi96 Jan 23, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, the key-prefix here does not necessarily to be the same as the key-prefix specifies by the user.

One use case I imagine is that user has a S3 path bucket:/path/to/top_level_logs/* where they have different set of logs.
and maybe one invocation is that user wants to compress the logs of a specific application (maybe even within a specific timerange) by entering sbin/compress bucket:/path/to/top_level_logs/my_application/log-2025-01-*. Could be an over complicated use case though.


:::{note}
The `s3` subcommand only supports a single URL but will compress any logs that have the given
prefix.

If you wish to compress a single log file, specify the entire path to the log file. However, if that
log file's path is a prefix of another log file's path, then both log files will be compressed
(e.g., with two files "logs/syslog" and "logs/syslog.1", a prefix like "logs/syslog" will cause
both logs to be compressed). This limitation will be addressed in a future release.
:::

[add-iam-policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html#embed-inline-policy-console
102 changes: 102 additions & 0 deletions docs/src/user-guide/guides-using-object-storage/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Using object storage

CLP can:

* compress logs from object storage (e.g., S3);
* store archives on object storage; and
* view the compressed logs from object storage.

This guide explains how to configure CLP for all three use cases. Note that you can choose to use
object storage for any combination of the three use cases (e.g., compress logs from S3 and view the
compressed logs from S3, but store archives on the local filesystem).

:::{note}
Currently, only the [clp-json][release-choices] release supports object storage. Support for
`clp-text` will be added in a future release.
:::

:::{note}
Currently, CLP only supports using S3 as object storage. Support for other object storage services
will be added in a future release.
:::

## Prerequisites

1. An S3 bucket and [key prefix][aws-key-prefixes] containing the logs you wish to compress.
Comment thread
haiqi96 marked this conversation as resolved.
Resolved
* An S3 URL is a combination of a bucket name and a key prefix as shown below:

:::{mermaid}
%%{
init: {
"theme": "base",
"themeVariables": {
"primaryColor": "#0066cc",
"primaryTextColor": "#fff",
"primaryBorderColor": "transparent",
"lineColor": "#9580ff",
"secondaryColor": "#9580ff",
"tertiaryColor": "#fff"
}
}
}%%
graph TD
A["s3://my-bucket-name/my-logs-dir/"] --"Bucket name"--> B[my-bucket-name]
A --"Key prefix"--> C[path/to/my/file.txt]
:::

2. An S3 bucket and key prefix where you wish to store compressed archives.
3. An S3 bucket and key prefix where you wish to store intermediate files for viewing compressed
logs.
4. An AWS IAM user with the necessary permissions to access the S3 prefixes mentioned above.
* To create a user, follow [this guide][aws-create-iam-user].
* You may use a different IAM user for each use case to follow the
[principle of least privilege][least-privilege-principle], or you can use the same user for

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would get rid of this principle of least privilege sentence.

You may use a single IAM user for all buckets, or a separate IAM user for each bucket.

My knowledge of aws security rings is weak but...
I think it is a bit weird suggesting that they have multiple IAM users as best practice. I think in general someone working at a company would only have one IAM user, and can cannot create new ones. Like I don't think multiple IAM user is normal, and multiple IAM roles would make more sense. I may be completely wrong here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in general it probably makes sense to provide IAM role support later on.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of agree that it might be weird for someone to have more than one users. Maybe we should just ask them to use one account as default?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the way I reworded the sentence helps a bit. By putting the single user case first. But maybe there is a better way

all three.
* For brevity, we'll refer to this user as the "CLP IAM user" in the rest of this guide.

:::{note}
CLP currently requires IAM user (long-term) credentials to access the relevant S3 buckets. Support

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just double checked the IAM user creation. The access key is not created by default when creating the user from AWS console, so user need to manually create it.

Should we point user to this guide somewhere? https://docs.aws.amazon.com/keyspaces/latest/devguide/create.keypair.html

Note that AWS's recommendation is to not use long-term key, so I guess it's better to mention that this solution is temporary and we will support temporary key (which you already mentioned in the note)

for other authentication methods (e.g., temporary credentials) will be added in a future release.
:::

## Use cases

The following subsections below explain how to set up each use case:

::::{grid} 1 1 1 1
:gutter: 2

:::{grid-item-card}
:link: compress
Compressing logs
^^^
Compressing logs from object storage
:::

:::{grid-item-card}
:link: archive-storage
Storing archives
^^^
Storing archives on object storage
:::

:::{grid-item-card}
:link: stream-storage
Viewing compressed logs
^^^
Viewing compressed logs from object storage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about term Viewing compressed logs from object storage.
It may give people an impression that it's about viewing the "logs stored in object storage", which could cause confusion.
It's hard to explain intermediate files in a short title though. should we briefly explain what's going on underthehood at the beginning of stream-storage.md?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could cause confusion

What would be the specific ambiguity?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's say my configuration is storing archives on S3, and use local FS storage for log viewer.
Can this be interpreted as Viewing compressed logs from object storage, since the logs to be viewed are indeed from object storage.

:::
::::

:::{toctree}
:hidden:

compress
archive-storage
stream-storage
:::

[aws-create-iam-user]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html
[aws-key-prefixes]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html
[least-privilege-principle]: https://en.wikipedia.org/wiki/Principle_of_least_privilege
[release-choices]: ../quick-start-cluster-setup/index.md#choosing-a-release
96 changes: 96 additions & 0 deletions docs/src/user-guide/guides-using-object-storage/stream-storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Viewing compressed logs

To view compressed logs from S3, you'll need to:

1. Enable the CLP IAM user to access the S3 path where stream files (logs in a format viewable by
the log viewer) should be stored.
2. Set up a cross-origin resource sharing (CORS) policy for the S3 path in (1).
3. Configure CLP to store stream files under the S3 path in (1).

## IAM user configuration

Attach the following policy to the CLP IAM user by following [this guide][add-iam-policy].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing link definition.

The link reference [add-iam-policy] is undefined.

Add the following link definition at the bottom of the file:

[add-iam-policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html#add-policies-console
🧰 Tools
🪛 Markdownlint (0.37.0)

12-12: Missing link or image reference definition: "add-iam-policy"
Reference links and images should use a label that is defined

(MD052, reference-links-images)


```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::<bucket-name>/<key-prefix>/*"
]
}
]
}
```

## Cross-origin resource sharing (CORS) configuration

For CLP's log viewer to be able to view the compressed logs from S3 over the internet, the S3 bucket
must have a CORS policy configured.

Add the CORS configuration below to your bucket by following [this guide][aws-cors-guide]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing link definition.

The link reference [aws-cors-guide] is undefined.

Add the following link definition at the bottom of the file:

[aws-cors-guide]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html
🧰 Tools
🪛 Markdownlint (0.37.0)

37-37: Missing link or image reference definition: "aws-cors-guide"
Reference links and images should use a label that is defined

(MD052, reference-links-images)


```json
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": [
"Access-Control-Allow-Origin"
]
}
]
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Strengthen CORS security warning.

The CORS configuration uses wildcards which pose security risks in production environments.

Add this warning before the CORS configuration:

:::{warning}
Using wildcards (`"*"`) in CORS policies is not recommended for production environments as it allows requests from any origin. Instead:

1. For development:
```json
{
  "AllowedOrigins": ["http://localhost:3000"]
}
  1. For production:
{
  "AllowedOrigins": [
    "https://your-domain.com",
    "https://alternate-domain.com"
  ]
}

:::


<!-- This is an auto-generated comment by CodeRabbit -->


:::{tip}
The CORS policy above allows requests from any host (origin). If you already know what hosts will
access CLP's web interface, you can enhance security by changing `AllowedOrigins` from `*` to the
specific list of hosts that will access the web interface.
:::

## Configuring CLP's stream storage location

To configure CLP to store stream files on S3, update the `stream_output.storage` key in
`<package>/etc/clp-config.yml`:

```yaml
stream_output:
storage:
type: "s3"
staging_directory: "var/data/staged-streams" # Or a path of your choosing
s3_config:
region_code: "<region-code>"
bucket: "<bucket-name>"
key_prefix: "<key-prefix>"
credentials:
access_key_id: "<aws-access-key-id>"
secret_access_key: "<aws-secret-access-key>"

# stream_output's other config keys
```

The configuration keys above function identically to those in `archive_output.storage`, except they
should be configured to use a different S3 path.

:::{note}
To view compressed log files, clp-text currently converts them into IR streams that the log viewer
can open, while clp-json converts them into JSONL streams. These streams only need to be stored for
as long as the streams are being viewed, but CLP currently doesn't explicitly delete the streams.
This limitation will be addressed in a future release.
:::

[aws-cors-guide]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html
[add-iam-policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html#embed-inline-policy-console
16 changes: 16 additions & 0 deletions docs/src/user-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ Quick start
A quick start guide for setting up a CLP cluster, compressing your logs, and searching them.
:::

:::{grid-item-card}
:link: guides-overview
Guides
^^^
Guides for using CLP in a variety of use cases.
:::

:::{grid-item-card}
:link: core-overview
Core
Expand Down Expand Up @@ -47,6 +54,15 @@ quick-start-compression/index
quick-start-search/index
:::

:::{toctree}
:hidden:
:caption: Guides
:glob:

guides-overview
guides-using-object-storage/index
:::

:::{toctree}
:hidden:
:caption: Core
Expand Down
Loading