Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Nginx getting-started catalog component for setting up fluent-bit… #166

Merged
merged 20 commits into from
Jul 30, 2024

Conversation

YANG-DB
Copy link
Member

@YANG-DB YANG-DB commented Jun 26, 2024

Description

add Nginx getting-started catalog component for setting up fluent-bit agent for:

  • collecting
  • transforming
  • shipping Nginx

Also includes live docker compose sample to run for showcasing the instructions

The updated schema for the integration will contain an optional getting-started field containing:

    "workflows": [
      {
        "name": "fluent-bit",
        "description": "This is a fluent-bit based getting started instructions tutorial",
        "steps": [
          {
            "name": "Fluent-Bit Parser",
            "type": "console-cmd",
            "label": "Log Parsing",
            "info": "<info URL>",
            "description": "Setup Fluent-Bit parser config file parsing Nginx access log fields",
            "content": "[PARSER]\n    Name   apache\n    Format regex\n    Regex  ...."
             ... 
       
          },

Schema Fields :

  • Workflows contains a list of getting-started named workflows
  • Each workflow contains a list of named steps
  • Each step has a type, content, input-params and description, info, input-params
  • Type can be on of the following: console-cmd, file-url , image, video
  • Content holds the command to be run
  • Description describes the actual step task
  • Info links to an external file (in the file-url case) or to additional documentation in other cases
  • input-params is a set of user input that has to be replaced before running the command

Issues Resolved

#165

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

… agent for collecting, transforming and shipping Nginx access logs into opensearch

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
{
"name": "Fluent-Bit Log Converter",
"label": "Log Parsing",
"info": "<info URL>",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these supposed to still be placeholders?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks - moved into draft util all the comments / questions are resolved

],
"liveDemo": {
"command": "docker-compose up -d",
"path": "<docker-compose-url>"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another placeholder

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks - moved into draft util all the comments / questions are resolved

"label": "Log Parsing",
"info": "<info URL>",
"description": "Setup Fluent-Bit logs converter lua script config file converting Nginx access log into Simple schema format",
"content": "local hexCharset = \"0123456789abcdef\"\nlocal function randHex(length)\n if length > 0 then\n local index = math.random(1, #hexCharset)\n return randHex(length - 1) .. hexCharset:sub(index, index)\n else\n return \"\"\n end\nend\n\nlocal function format_apache(c)\n return string.format(\n \"%s - %s [%s] \\\"%s %s HTTP/1.1\\\" %s %s\",\n c.host,\n c.user,\n os.date(\"%d/%b/%Y:%H:%M:%S %z\"),\n c.method,\n c.path,\n c.code,\n c.size\n )\nend\n\nlocal function format_nginx(c)\n return string.format(\n \"%s %s %s [%s] \\\"%s %s HTTP/1.1\\\" %s %s \\\"%s\\\" \\\"%s\\\"\",\n c.remote,\n c.host,\n c.user,\n os.date(\"%d/%b/%Y:%H:%M:%S %z\"),\n c.method,\n c.path,\n c.code,\n c.size,\n c.referer,\n c.agent\n )\nend\n\nlocal formats = {\n [\"apache.access\"] = format_apache,\n [\"nginx.access\"] = format_nginx\n}\n\nfunction convert_to_otel(tag, timestamp, record)\n local data = {\n traceId=randHex(32),\n spanId=randHex(16),\n [\"@timestamp\"]=os.date(\"!%Y-%m-%dT%H:%M:%S.000Z\"),\n observedTimestamp=os.date(\"!%Y-%m-%dT%H:%M:%S.000Z\"),\n body=formats[tag](record),\n attributes={\n data_stream={\n dataset=tag,\n namespace=\"production\",\n type=\"logs\"\n }\n },\n event={\n category=\"web\",\n name=\"access\",\n domain=tag,\n kind=\"event\",\n result=\"success\",\n type=\"access\"\n },\n http={\n request={\n method=record.method\n },\n response={\n bytes=tonumber(record.size),\n status_code=tonumber(record.code)\n },\n flavor=\"1.1\",\n url=record.path\n },\n communication={\n source={\n address=\"127.0.0.1\",\n ip=record.remote\n }\n }\n }\n return 1, timestamp, data\nend\n"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better for content to be a file ref like what we have for the other long-form content in integrations. Makes the config file smaller and easier to read, and makes an easier editing experience.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Swiddis can u plz share an example for the above content ?

@YANG-DB YANG-DB marked this pull request as draft July 3, 2024 02:20
Signed-off-by: YANGDB <yang.db.dev@gmail.com>
Signed-off-by: YANGDB <yang.db.dev@gmail.com>
add getting started dashboard asset + markdown

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
add getting started dashboard asset + markdown

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
add getting started dashboard asset + markdown

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
Signed-off-by: YANGDB <yang.db.dev@gmail.com>
@YANG-DB YANG-DB added integration integration related content and removed enhancement New feature or request labels Jul 12, 2024
@YANG-DB YANG-DB marked this pull request as ready for review July 12, 2024 02:44
@YANG-DB YANG-DB requested a review from Swiddis July 12, 2024 02:44
Signed-off-by: YANGDB <yang.db.dev@gmail.com>
 - quickstart
 - connect to an existing collector

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
Signed-off-by: YANGDB <yang.db.dev@gmail.com>
Signed-off-by: YANGDB <yang.db.dev@gmail.com>
Signed-off-by: YANGDB <yang.db.dev@gmail.com>
…on resource

- getting started
   - getting_started.json - metadata
   - Getting-Started.md - markdown
   - sample.json - sample data

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
…on resource

- getting started
   - getting_started.json - metadata
   - Getting-Started.md - markdown
   - data - sample data

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
…on resource

- getting started
   - getting_started.json - metadata
   - Getting-Started.md - markdown
   - data - sample data

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
@@ -44,6 +44,7 @@
{ "name": "logs", "version": "1.0.0" }
],
"assets": [
{ "name": "getting-started-tutorial", "version": "1.0.0", "extension": "ndjson", "type": "savedObjectBundle", "workflows": ["dashboards"] },
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the intended flow to present this to the user? Making it a saved object bundle associated with the integration means that it won't be added to the cluster until after they set up the integration.

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
@YANG-DB YANG-DB merged commit 47cd435 into opensearch-project:main Jul 30, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration integration related content
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants