Skip to content

Commit

Permalink
Update the licence headers (#620)
Browse files Browse the repository at this point in the history
Also add comments on custom flattening for Kinesis Data Firehose
events
  • Loading branch information
nitisht authored Jan 12, 2024
1 parent 123a317 commit 8406183
Show file tree
Hide file tree
Showing 75 changed files with 108 additions and 78 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Parseable Server (C) 2022 - 2023 Parseable, Inc.
# Parseable Server (C) 2022 - 2024 Parseable, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Parseable Server (C) 2022 - 2023 Parseable, Inc.
# Parseable Server (C) 2022 - 2024 Parseable, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/about.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/alerts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/alerts/parser.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/alerts/rule.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/alerts/target.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/analytics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/banner.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/catalog.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/catalog/column.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/catalog/manifest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/catalog/snapshot.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/event.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/event/format.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/event/format/json.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/event/writer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/event/writer/file_writer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/event/writer/mem_writer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
14 changes: 10 additions & 4 deletions server/src/handlers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -22,16 +22,22 @@ pub mod livetail;
const PREFIX_TAGS: &str = "x-p-tag-";
const PREFIX_META: &str = "x-p-meta-";
const STREAM_NAME_HEADER_KEY: &str = "x-p-stream";
const AUTHORIZATION_KEY: &str = "authorization";
const KINESIS_COMMON_ATTRIBUTES_KEY: &str = "x-amz-firehose-common-attributes";
const LOG_SOURCE_KEY: &str = "x-p-log-source";

const AUTHORIZATION_KEY: &str = "authorization";
const SEPARATOR: char = '^';

const OIDC_SCOPE: &str = "openid profile email";
const COOKIE_AGE_DAYS: usize = 7;
const SESSION_COOKIE_NAME: &str = "session";
const USER_COOKIE_NAME: &str = "username";

// constants for Log Source values for known sources
// constants for log Source values for known sources and formats
const LOG_SOURCE_KINESIS: &str = "kinesis";

// OpenTelemetry sends data in JSON format with
// specification as explained here https://opentelemetry.io/docs/specs/otel/logs/data-model/
const LOG_SOURCE_OTEL: &str = "otel";

// AWS Kinesis constants
const KINESIS_COMMON_ATTRIBUTES_KEY: &str = "x-amz-firehose-common-attributes";
2 changes: 1 addition & 1 deletion server/src/handlers/http.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/about.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/health_check.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/ingest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
26 changes: 25 additions & 1 deletion server/src/handlers/http/kinesis.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -37,6 +37,30 @@ struct Data {
data: String,
}

// Flatten Kinesis logs is used to flatten the Kinesis logs into a queryable JSON format.
// Kinesis logs are in the format
// {
// "requestId": "9b848d8a-2d89-474b-b073-04b8e5232210",
// "timestamp": 1705026780451,
// "records": [
// {
// "data": "eyJDSEFOR0UiOi0wLjQ1LCJQUklDRSI6NS4zNiwiVElDS0VSX1NZTUJPTCI6IkRFRyIsIlNFQ1RPUiI6IkVORVJHWSJ9"
// }
// ]
// }
// The data field is base64 encoded JSON (there can be multiple data fields), and there is a requestId and timestamp field.
// Kinesis logs are flattened to the following format:
// {
// "CHANGE": 3.16,
// "PRICE": 73.76,
// "SECTOR": "RETAIL",
// "TICKER_SYMBOL": "WMT",
// "p_metadata": "",
// "p_tags": "",
// "p_timestamp": "2024-01-11T09:08:34.290",
// "requestId": "b858288a-f5d8-4181-a746-3f3dd716be8a",
// "timestamp": "1704964113659"
// }
pub fn flatten_kinesis_logs(body: &Bytes) -> Vec<BTreeMap<String, Value>> {
let body_str = std::str::from_utf8(body).unwrap();
let message: Message = serde_json::from_str(body_str).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/llm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/logstream.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/middleware.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/oidc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/query.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/rbac.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/http/role.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/livetail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/livetail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/localcache.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/metrics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/metrics/storage.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/migration.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/migration/metadata_migration.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/migration/schema_migration.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/migration/stream_metadata_migration.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/oidc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/option.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/query.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/query/filter_optimizer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion server/src/query/listing_table_builder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Parseable Server (C) 2022 - 2023 Parseable, Inc.
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down
Loading

0 comments on commit 8406183

Please sign in to comment.