livepeer / livepeer/cdn-log-puller

Bounty: Create A CDN Log Analytics Tool

Open
#1 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
0
Forks
2
PR merge metrics
No merged PRs in 30d

Description

**Goal**: Create a custom CDN log analytics tool for Livepeer video streams.

**Scope**
We want to be able to analyze CDN data usage per video stream.

This tool should contain the following features:
1. Pulls a list of logs down from GCS `gsutil -o "GSUtil:parallel_process_count=1" -m cp -r gs://{bucket-name} {local-dir}`
2. Analyzes the logs in a local directory. It should iterate through the directory recursively to make sure all log files in sub directories are analyzed. It should be performant, taking advantage of multiple processors on a machine so it can be ran on a high-cpu cloud instance. This tool is meant to be used once-a-month, and the expected dataset can be up to 20GB.
3. Return a report of the total data usage for each stream, as well as a sql query that allows a user to insert the report into a postgres database.

Example commands:
* `log-analyzer download {gs-bucket-url}`
* `log-analyzer analyze {local-dir} -o report.csv`
* `log-analyzer analyze {local-dir} -o insert.sql`
* `log-analyzer insert {postgres-db-info}`

The report should contain:
* `manifest_id` (This is in the format of `4950yo5vcetc1cvu`)
* `stream_id` (This is in the format of `a2c50bb5-d6d5-481d-a50f-90dece3fae71`)
* `stream_name` (This is in the format of `video+4950yo5vcetc1cvu`)
* `date`
* `number_viewers` (inferred by number of unique client ips)
* `total_filesize`
* `total_cs_bytes`
* `total_sc_bytes`
* `url`
* `response_code`

Looking at the example log files, you will see that Livepeer stream URLs are formatted like:
* `/hls/{manifest_id}/{rendition}/{segment}.ts` (video segment)
* `/hls/{manifest_id}/{rendition}/index.m3u8` (rendition playlist)
* `/hls/{manifest_id}/index.m3u8` (master playlist)
* `/recordings/{stream_id}/index.m3u8`
* `/hls/{stream_name}/index.m3u8`

Each of the log lines also contain the filesize, the client-to-server bytes transferred (cs-bytes), server-to-client bytes transferred (sc-bytes), and the client ip (c-ip).

This tool should not crash. If unexpected URLs appear in the logs - and instead, log a warning message.

**Requirements**:
* Use golang.
* Contains unit tests.
* Contains documentation on how to use the tool.
* Contains high level performance benchmark (amount of time it took to process different sizes of data, up to 20GB).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No existing files or entry points are named. Start by reviewing the command examples, CDN URL formats, report fields, and required GCS/Postgres workflow, then define the tool boundaries before implementing. Done means recursive analysis with parallel processing, warnings for unexpected URLs, unit tests, usage documentation, and benchmarks through 20GB.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, google-cloud, postgresql
Domain
cli, cloud, data, databases, documentation, performance, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.