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

[oracle_weblogic] Add Integration Package with Admin Server Logs Data Stream #3066

Merged

Conversation

kush-elastic
Copy link
Collaborator

@kush-elastic kush-elastic commented Apr 11, 2022

  • Enhancement

What does this PR do?

  • Generated the skeleton of Oracle WebLogic integration package.
  • Added 1 data stream (Admin Server Logs).
  • Added data collection logic for the data streams.
  • Added the ingest pipeline for the data streams.
  • Mapped fields according to the ECS schema and added Fields metadata in the appropriate yaml files.
  • Added dashboards and visualizations.
  • Added system test cases for the data stream.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

How to test this PR locally

  • Clone integrations repo.
  • Install elastic-package locally.
  • Start elastic stack using elastic-package.
  • Move to integrations/packages/oracle_weblogic directory.
  • Run the following command to run tests.
    elastic-package test

Related issues

Screenshots

Oracle WebLogic  Admin Server Dashboard

@kush-elastic kush-elastic requested a review from a team as a code owner April 11, 2022 18:48
@elasticmachine
Copy link

elasticmachine commented Apr 11, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-05-17T16:39:17.642+0000

  • Duration: 16 min 49 sec

Test stats 🧪

Test Results
Failed 0
Passed 8
Skipped 0
Total 8

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented Apr 29, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (1/1) 💚
Files 100.0% (1/1) 💚 3.589
Classes 100.0% (1/1) 💚 3.589
Methods 100.0% (9/9) 💚 11.711
Lines 100.0% (56/56) 💚 10.985
Conditionals 100.0% (0/0) 💚

required: true
show_user: true
default:
- /tmp/service_logs/logs/AdminServer.log
Copy link
Contributor

Choose a reason for hiding this comment

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

In general, i have seen /user_projects/domains/wls_domain/servers/AdminServer.log or similar as the default path fof AdminServer log. You may validate this to correct the default path of AdminServer.log file

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@agithomas agithomas left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

AFAIR there are two types of logs: server and domain. What are format differences between admin_server, managed_server and domain logs? Can we squeeze them into a single data stream?

Comment on lines 3 to 7
weblogic-log:
image: alpine
volumes:
- ./sample_logs:/sample_logs:ro
- ${SERVICE_LOGS_DIR}:/var/log
Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't the Oracle WebLogic. Please use the right Docker image with the application running.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense. However, I see in the documentation (Page 8) that we'll need to download supported supplements for Oracle WebLogic which seems to have a Oracle Account signed in as a prerequisite and accepting their terms and policies via GUI (which does not seem to be feasible to achieve here).

First, decide which installation type you want to use, either generic, quick, or slim installer, and then download the required Oracle WebLogic Server installer to the dockerfiles/12.2.1.4 folder.

@mtojek / @kush-elastic, do you have any ideas for the same?

Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tried playing with any of these: dockerfiles?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, we tried using this. But what is blocking us to use that docker image directly is while running that dockerfile present in repo, we need to download this supplements.
To download that supplements we need oracle login (manually).

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that we need access to container-registry.oracle.com to run:

docker pull container-registry.oracle.com/middleware/weblogic:12.2.1.4, right?

@v1v do you think that we can pull/copy them into our Docker registry? Let me justify as this is a longer path. If we want to maintain and develop observability tools for Oracle products, then we need an official/corp account there.

Copy link
Member

Choose a reason for hiding this comment

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

do you think that we can pull/copy them into our Docker registry?

I think so, if you can raise an issue in the obt-robots

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, raised an internal issue.

@kush-elastic Please note here which images would be useful for testing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @mtojek, We will check for the exact requirement over the docker image and the required supplements and will get back on this.

Copy link
Collaborator Author

@kush-elastic kush-elastic May 10, 2022

Choose a reason for hiding this comment

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

Hey @mtojek,

With reference to this discussion #3298

We had a query related to the sample docker files and container scripts used in the docker files, we will be copying and combining these two docker-files (File1, File2) into a single docker file as we want an application to be deployed on managed and admin server. We hope there won't be any consequences in combining these files and using them as one.

We will also be combining all the scripts under one folder from these two folders folder1 and folder2 as it is required for the current use case. we just wanted to confirm this as we can see the Copyright License on each of the files mentioned, hope that it won't cause any issue here as this are the samples files, or is their any other suggestions from your side.

Copy link
Contributor

@mtojek mtojek May 10, 2022

Choose a reason for hiding this comment

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

As far as I can see, these files are distributed based on the UPL 1.0 license, which is considered safe according to the Open Source policy in Elastic.

Please add the NOTICE.txt file with a copy of the original license and the link to the docker-images repository.

"diagnostic_context_id": "1648117791865",
"machine_name": "wlsadmin",
"message_id": "BEA-002622",
"message_text": "The protocol \"admin\" is now configured.",
Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't aligned with ECS, there is a log.message field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mtojek Tried to look for the log.message field but could not find it in the ECS mapping can you guide me to the specific ECS reference.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, sorry, my bad. Not log.message but just message.


ignore_failure: true
- script:
description: Drops null/empty values recursively
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it required? What exactly are you dropping?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This script is used for removing empty fields. So we are using it when we get empty value for any of the fields in the log message.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the drop_fields processor we will explicitly need to provide set of all the possible fields which can possibly have a NULL value, However the above script processor will go through every field in the document and check if any field is NULL or "" and will drop the fields accordingly. Still WDYT should we change this?

Copy link
Contributor

@mtojek mtojek May 9, 2022

Choose a reason for hiding this comment

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

I would go with the prebuilt processor as this is less error-prone. Is it common to observe "" fields?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We tried going through drop_fields processor it seems that drop_fields is used to preprocess the document before it actually parse through the ingest pipeline. We also looked into the drop processor which actually drops the entire document and not just the empty fields. So can we prefer this Script instead of any other processor as we can find same script in previously created integrations as well

Ref:

  1. https://github.com/elastic/integrations/blob/main/packages/aws/data_stream/cloudtrail/elasticsearch/ingest_pipeline/default.yml#:~:text=Drops%20null/empty%20values%20recursively
  2. https://github.com/elastic/integrations/blob/main/packages/okta/data_stream/system/elasticsearch/ingest_pipeline/default.yml#:~:text=Drops%20null/empty%20values%20recursively

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, thanks for explaining!

@andrewkroh, QQ as you have definitely more experience with pipeline processing. Does it look like a good candidate for a new ES processor?

Copy link
Member

Choose a reason for hiding this comment

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

It's a common enough pattern that I think it could be processor. Often we see data sources that put values like "-" or empty strings into the event and we want to "clean" those from the event. Alternatively we could check every known field and conditionally drop it, but that becomes verbose.

# newer versions go on top
- version: "0.1.0"
changes:
- description: Oracle WebLogic integration package with Admin server datastream
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: data stream


### Admin Server logs

The `admin_server` data stream collects Admin Server logs from Adminserver.log.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Adminserver.log

title: "Oracle WebLogic"
version: 0.1.0
license: basic
description: "This Elastic integration collects logs and metrics from Oracle WebLogic."
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep it consistent with other integrations. Please refer #2614 (comment)

@@ -0,0 +1,31 @@
format_version: 1.0.0
name: oracle_weblogic
title: "Oracle WebLogic"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: title: Oracle WebLogic

@@ -0,0 +1,23 @@
paths:
{{#each paths as |path i|}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused variable: i

{{#if preserve_original_event}}
- preserve_original_event
{{/if}}
{{#each tags as |tag i|}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused variable i

Copy link
Contributor

@yug-rajani yug-rajani left a comment

Choose a reason for hiding this comment

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

Requested some changes

@kush-elastic
Copy link
Collaborator Author

AFAIR there are two types of logs: server and domain. What are format differences between admin_server, managed_server and domain logs? Can we squeeze them into a single data stream?

We discussed with @akshay-saraswat for the same and based on discussion we decided to separate logs to 4 logs data-stream.

@@ -0,0 +1,37 @@
Repository: https://github.com/oracle/docker-images
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hey @mtojek, we have added the licensing details in this file as discussed here by referring to this integrations here.
Can you please take a look and let us know if it's fine and won't cause any issues going further?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this NOTICE.txt to the _dev/deploy as, as far as I can see, Oracle resources are only used for testing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When we moved NOTICE.txt to _dev/deploy, we faced a lint error when linting the integration using elastic-package lint.

Error: linting package failed: found 1 validation error:
   1. item [NOTICE.txt] is not allowed in folder [/home/devuser/kush/integrations/packages/oracle_weblogic/_dev/deploy]

Should we keep it as it is or do you suggest moving it somewhere else?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move it close to the Dockerfile.

Copy link
Contributor

@yug-rajani yug-rajani left a comment

Choose a reason for hiding this comment

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

LGTM, I am not sure on how the NOTICE.txt entry should be added as per #3066 (comment). Please wait for @mtojek's approval over the same.


# Pull base image
# ---------------
FROM docker.elastic.co/observability-ci/weblogic:12.2.1.3-dev
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wanted to clarify: did you copy all files from the original repository (docker-images) or implemented them manually?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, we copied (clubbed file1 and file2 logically) the files form docker images repository and did some minor changes where required.

services:
wlsadmin:
build:
context: .
Copy link
Contributor

Choose a reason for hiding this comment

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

Why exactly do we need to build this image?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We are actually adding sample application along with Admin Server and Managed Server configuration. Also, we are downloading and configuring Jolokia for data collection. so we would need to build the image.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I see now.

One more question, are those scripts bound to a specific image version of Oracle? If so, it might be worth mentioning it. Maybe another CONTRIBUTING.md file?

Copy link
Collaborator Author

@kush-elastic kush-elastic May 17, 2022

Choose a reason for hiding this comment

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

No they aren't we tried to run the system test with same configuration using three docker images (three versions of weblogic)

  • container-registry.oracle.com/middleware/weblogic:14.1.1.0-dev-8 (14.1.1.0 version)
  • container-registry.oracle.com/middleware/weblogic:12.2.1.4-dev (12.2.1.4 version)
  • container-registry.oracle.com/middleware/weblogic:12.2.1.3-dev (12.2.1.3 version)

context: .
args:
- APPLICATION_NAME=sample
- APPLICATION_PKG=archive.zip
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great if you can drop sources somewhere or, even better, use sources and build them in-the-fly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just to give you a quick background, we built the archieve.zip by running build.sh locally, we thought it would be a good idea to keep it here (because of its tiny size) rather than building it in-the-fly.

Just in case we run into any troubles building it in-the-fly, can you please elaborate how do we "drop sources somewhere"?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean a similar way to what Sunny implemented here: spring_boot. We don't need a full blown WAR application, just a simple and small PoC.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this is a full-blown WAR application, it's just a single page application which basically gives data related to server and it's pretty small in size.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's the point, it's easier for developers to the main source than repack WAR, setup environment, maven deps, etc.

@@ -0,0 +1,37 @@
Repository: https://github.com/oracle/docker-images
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this NOTICE.txt to the _dev/deploy as, as far as I can see, Oracle resources are only used for testing.

@kush-elastic kush-elastic requested a review from mtojek May 17, 2022 13:21
@kush-elastic
Copy link
Collaborator Author

Thanks for the approval, @mtojek!
@agithomas, can you please take a second look at this PR as the code owner?

@agithomas
Copy link
Contributor

Sure @kush-elastic . Checking ..

Copy link
Contributor

@agithomas agithomas left a comment

Choose a reason for hiding this comment

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

Looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Integration:oracle_weblogic Oracle WebLogic New Integration Team:Service-Integrations Label for the Service Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Oracle Weblogic Integration
8 participants