Skip to content

Commit

Permalink
feat: parallelize feature for tcp (#2138)
Browse files Browse the repository at this point in the history
* feat:parallelize feature for tcp

* fix: endif of jinja2

* fx: upgrade syslog also for lite version

---------

Co-authored-by: Ilya Kheifets <ikheifets@splunk.com>
Co-authored-by: Ilya <138466237+ikheifets-splunk@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 18, 2023
1 parent eda07a2 commit 0280d86
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.


ARG SYSLOGNG_VERSION=4.2.0
ARG SYSLOGNG_VERSION=4.3.1
FROM ghcr.io/axoflow/axosyslog:${SYSLOGNG_VERSION}


Expand Down
2 changes: 1 addition & 1 deletion package/Dockerfile.lite
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.


ARG SYSLOGNG_VERSION=4.2.0
ARG SYSLOGNG_VERSION=4.3.1
FROM ghcr.io/axoflow/axosyslog:${SYSLOGNG_VERSION}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

log{
{%- if enable_parallelize == True %}
parallelize(partitions({{ parallelize_no_partitions }}));
{%- endif %}
{%- if mode == "SELECT" %}
parser {
app-parser(topic(sc4s-lp-dest-select-{{ destination }}));
Expand Down
17 changes: 16 additions & 1 deletion package/etc/conf.d/log_paths/2/lp_dest_alts_global/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@
import re

plugin_path = os.path.dirname(os.path.abspath(__file__))

templateLoader = jinja2.FileSystemLoader(searchpath=plugin_path)
templateEnv = jinja2.Environment(loader=templateLoader)
tm = templateEnv.get_template("plugin.jinja")

def normalize_env_variable_input(env_variable: str):
if os.getenv(env_variable, "no").lower() in [
"true",
"1",
"t",
"y",
"yes",
]:
normalized_value = True
else:
normalized_value = False
return normalized_value


regex_splunkhec = r"^SC4S_DEST_SPLUNK_HEC_(.*)_URL$"
regex_syslog = r"^SC4S_DEST_(SYSLOG|BSD)_(.*)_HOST$"
global_dests = {}
Expand Down Expand Up @@ -71,5 +84,7 @@
mode=m["mode"],
filter=m["filter"],
dtype=m["dtype"],
enable_parallelize=normalize_env_variable_input(f"SC4S_ENABLE_PARALLELIZE"),
parallelize_no_partitions=int(os.getenv(f"SC4S_PARALLELIZE_NO_PARTITION", 4)),
)
print(msg)
2 changes: 1 addition & 1 deletion package/etc/syslog-ng.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@version:4.2
@version:4.3


# syslog-ng configuration file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

log{
{%- if enable_parallelize == True %}
parallelize(partitions({{ parallelize_no_partitions }}));
{%- endif %}
{%- if mode == "SELECT" %}
parser {
app-parser(topic(sc4s-lp-dest-select-{{ destination }}));
Expand Down

0 comments on commit 0280d86

Please sign in to comment.