Skip to content

Commit

Permalink
Move to pyproject.toml. Add processors, documentation updates. (hashi…
Browse files Browse the repository at this point in the history
…corp-forge#26)

* Add processors. Move to pyproject.toml.

* Cache calls to quote_aware_split.

* Update processor base class to allow finalize only

This was possible prior to this commit, but required a stub method for process to be implemented.

* Add local file secret backend.

* Remove caching to prevent unexpected mutation.

* Documentation updates.

* Version bump for new release.

* Update build process for pyproject.toml

* Only write processed data if processors are configured.

By default both a processed and raw output stream are configured to simplify configuration. However, this means that if no processors are used logs will be written twice. This pull-request prevents that, and instead only write out data if processors are configured.

* Fix up logger error.

* Update grove/outputs/__init__.py

Co-authored-by: Jonas Plum <[email protected]>

* Address pull-request comments.

---------

Co-authored-by: Jonas Plum <[email protected]>
  • Loading branch information
hcpadkins and cugu committed Jul 24, 2023
1 parent cdac3b1 commit ed891e9
Show file tree
Hide file tree
Showing 85 changed files with 1,612 additions and 614 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- run: pip install --upgrade pip setuptools wheel tox
- run: python setup.py install # required for e2e tests
- run: pip install . # required for e2e tests
- run: make lint
- run: tox
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: python -m pip install --upgrade pip setuptools wheel twine

- name: Build package
run: python setup.py sdist bdist_wheel
run: python -m build

- name: Publish Python package
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
28 changes: 7 additions & 21 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
{
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--config setup.cfg"
],
"python.linting.mypyEnabled": true,
"python.linting.mypyArgs": [
"--config-file setup.cfg"
],
"isort.args": [
"-sp setup.cfg"
],
"python.linting.pylintEnabled": false,
"python.formatting.provider": "none",
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": true,
},
"editor.tabSize": 4,
"editor.formatOnSave": true
"editor.defaultFormatter": "ms-python.black-formatter",
},
"editor.rulers": [
88
],
"[terraform]": {
"editor.tabSize": 2,
"editor.formatOnSave": true
Expand All @@ -33,9 +24,4 @@
"editor.tabSize": 2,
"editor.autoIndent": "advanced"
},
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Grove

> Grove is not an official HashiCorp project.
<p align="center">
<br /><br />
<img src="docs/static/grove-logo-small.png?raw=True" alt="Grove">
<br />
</p>

Grove is a Software as a Service (SaaS) log collection framework, designed to support
collection of logs from services which do not natively support log streaming.
Expand All @@ -24,6 +26,12 @@ us via email at [email protected], rather than filing a GitHub issue.

### Supported Sources

<p align="center">
<br /><br />
<img src="docs/static/grove-support.png?raw=True" alt="Grove support overview">
<br />
</p>

Currently the following log sources are supported by Grove out of the box. If a source
isn't listed here, support can be added by creating a custom connector!

Expand Down
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ Subpackages
grove.helpers
grove.outputs
grove.secrets
grove.processors
21 changes: 4 additions & 17 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,11 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys

sys.path.insert(0, os.path.abspath("../grove/"))

# Set defaults, and then load __about__ from the project.
__title__ = None
__about__ = None
__author__ = None
__version__ = None
__copyright__ = None

exec(open(os.path.abspath("../grove/__about__.py")).read())

from grove.__about__ import __copyright__, __title__, __version__

# -- Project information -----------------------------------------------------

author = __author__
author = "HashiCorp Security (TDR)"
project = __title__.title()
copyright = __copyright__

Expand Down Expand Up @@ -63,7 +50,7 @@
# a list of builtin themes.
html_theme = "furo"
html_title = f"Grove v{__version__}"
html_logo = "static/grove.png"
# html_logo = "static/grove.png"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand All @@ -86,7 +73,7 @@
"admonition-title-font-size": "0.9rem",
},
"dark_css_variables": {
"color-foreground-secondary": "#444",
"color-foreground-secondary": "#9ca0a5",
"admonition-font-size": "0.9rem",
"admonition-title-font-size": "0.9rem",
},
Expand Down
1 change: 1 addition & 0 deletions docs/grove.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Subpackages
grove.helpers
grove.outputs
grove.secrets
grove.processors

Submodules
----------
Expand Down
26 changes: 22 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
Grove
=====
.. container:: clear-title

.. note::
Grove is not an official HashiCorp project.
.. image:: static/grove-logo-small.png
:alt: Grove
:align: center
:class: only-light

.. image:: static/grove-logo-small-light.png
:alt: Grove
:align: center
:class: only-dark

Grove is a Software as a Service (SaaS) log collection framework, designed to support
collection of logs from services which do not natively support log streaming.
Expand All @@ -27,6 +33,18 @@ us via email at [email protected], rather than filing a GitHub issue.
Supported Sources
-----------------

.. container:: clear-image

.. image:: static/grove-support.png
:alt: Supported Sources
:align: center
:class: only-light

.. image:: static/grove-support-light.png
:alt: Supported Sources
:align: center
:class: only-dark

Currently the following log sources are supported by Grove out of the box. If a source
isn't listed here, support can be added by creating a custom connector!

Expand Down
26 changes: 16 additions & 10 deletions docs/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ Flow

A rough diagram of the overall flow of a Grove run ("collection") can be found below.

.. image:: static/flow.png
:alt: Overall flow of a Grove collection
:align: center
.. container:: clear-image

.. image:: static/flow.png
:alt: Overall flow of a Grove collection
:align: center

Components
----------
Expand Down Expand Up @@ -64,9 +66,11 @@ A visual overview of the relationship between built-in Grove backends and their
base classes can be found below. Although the examples in this image are built-in
to Grove, they follow the same principals as any other Plugin.

.. image:: static/plugin_structure.png
:alt: Grove Module Overview
:align: center
.. container:: clear-image

.. image:: static/plugin_structure.png
:alt: Grove Module Overview
:align: center

Configuration
^^^^^^^^^^^^^
Expand Down Expand Up @@ -212,10 +216,12 @@ If no existing pointer is in the cache, the connector will provide an initial va
which is appropriate for the application. When Grove next runs, only log entries
generated since / after this pointer would be collected.

.. image:: static/pointers.png
:width: 384
:alt: How pointers are used.
:align: center
.. container:: clear-image

.. image:: static/pointers.png
:width: 384
:alt: How pointers are used.
:align: center

Cache
-----
Expand Down
42 changes: 30 additions & 12 deletions docs/static/custom.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
:root {
--text-color-override: #3d7c9b;
--text-color-override: #428cdb;
--title-color: #428cdb;
/* --text-color-override: #38a7d2; */
}

article {
Expand All @@ -21,23 +23,25 @@ h4,
h5 {
padding-top: 8px;
padding-bottom: 8px;
color: var(--text-color-override);
}

.sidebar-tree .toctree-l1 > .reference {
color: var(--text-color-override);
color: var(--title-color);
}

.sidebar-brand-text {
text-align: center;
color: var(--text-color-override);
}

.grove-logo h1 {
padding-top: 0px;
font-size: 420%;
padding-left: 10%;
text-align: center;
.sidebar-brand-text[data-theme="light"] {
color: #444 !important;
}

.sidebar-brand-text[data-theme="dark"] {
color: #FFF !important;
}

.sidebar-tree .toctree-l1 > .reference,
.sidebar-tree .toctree-l2 > .reference,
.sidebar-tree .toctree-l3 > .reference {
color: var(--text-color-override);
}

.sidebar-logo {
Expand All @@ -50,4 +54,18 @@ h5 {

p.admonition-title {
margin: 0 -0.9rem 0.8rem -0.9rem
}

.clear-image {
padding-top: 35px;
padding-bottom: 35px;
}

.clear-title {
padding-top: 35px;
padding-bottom: 50px;
}

.light-bg {
background-color: #FFF;
}
Binary file added docs/static/grove-logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/grove-logo-small-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/grove-logo-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/grove-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/grove-support-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/grove-support.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions grove/__about__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Grove metadata."""

__version__ = "1.0.0rc4"
__version__ = "1.0.0rc5"
__title__ = "grove"
__author__ = "HashiCorp Security (TDR)"
__license__ = "Mozilla Public License 2.0"
__copyright__ = "Copyright 2023 HashiCorp, Inc."
25 changes: 14 additions & 11 deletions grove/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@

"""A framework for collecting and transforming SaaS logs."""

from grove import caches # noqa: F401
from grove import configs # noqa: F401
from grove import connectors # noqa: F401
from grove import constants # noqa: F401
from grove import entrypoints # noqa: F401
from grove import exceptions # noqa: F401
from grove import helpers # noqa: F401
from grove import logging # noqa: F401
from grove import models # noqa: F401
from grove import outputs # noqa: F401
from grove import types # noqa: F401
from grove import (
caches, # noqa: F401
configs, # noqa: F401
connectors, # noqa: F401
constants, # noqa: F401
entrypoints, # noqa: F401
exceptions, # noqa: F401
helpers, # noqa: F401
logging, # noqa: F401
models, # noqa: F401
outputs, # noqa: F401
processors, # noqa: F401
types, # noqa: F401
)
from grove.__about__ import * # noqa: F401, F403
Loading

0 comments on commit ed891e9

Please sign in to comment.