-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for IBM datapower (#1279)
- Loading branch information
Ryan Faircloth
authored
Oct 1, 2021
1 parent
cd404ca
commit 6d08d16
Showing
6 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Vendor - IBM | ||
|
||
## Product - Data power | ||
|
||
| Ref | Link | | ||
|----------------|---------------------------------------------------------------------------------------------------------| | ||
| Splunk Add-on | https://splunkbase.splunk.com/app/4662/ | | ||
|
||
### Sourcetypes | ||
|
||
| sourcetype | notes | | ||
|----------------|---------------------------------------------------------------------------------------------------------| | ||
| ibm:datapower:syslog | Common sourcetype | | ||
| ibm:datapower:* | * is taken from the event sourcetype | | ||
| | ||
|
||
### Index Configuration | ||
|
||
| key | source | index | notes | | ||
|----------------|----------------|----------------|----------------| | ||
| ibm_datapower | na | inifraops | none | | ||
|
||
### Filter type | ||
|
||
Requires dedicated port or vendor_product_by_source configuration | ||
|
||
### Options | ||
|
||
|
||
| Variable | default | description | | ||
|----------------|----------------|----------------| | ||
| SC4S_LISTEN_IBM_DATAPOWER_TCP_PORT | empty string | Enable a TCP port for this specific vendor product using a comma-separated list of port numbers | | ||
| SC4S_LISTEN_IBM_DATAPOWER_UDP_PORT | empty string | Enable a UDP port for this specific vendor product using a comma-separated list of port numbers | | ||
| SC4S_ARCHIVE_IBM_DATAPOWER | no | Enable archive to disk for this specific source | | ||
| SC4S_DEST_IBM_DATAPOWER_HEC | no | When Splunk HEC is disabled globally set to yes to enable this specific source | | ||
|
||
|
||
### Verification | ||
|
||
An active site will generate frequent events use the following search to check for new events | ||
|
||
Verify timestamp, and host values match as expected | ||
|
||
``` | ||
index=<asconfigured> (sourcetype=cef source="ibm:datapower*") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
package/etc/conf.d/conflib/net_source/app-ibm_datapower.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
block parser ibm-datapower-parser() { | ||
channel { | ||
rewrite { | ||
r_set_splunk_dest_default( | ||
index('infraops') | ||
sourcetype('ibm:datapower:syslog') | ||
vendor_product("ibm_datapower") | ||
template('t_msg_only') | ||
); | ||
}; | ||
# | ||
if { | ||
filter { | ||
message( | ||
'\[[^\]]*\]\[([^\]]*)\]\[[^\]]*\]\s' | ||
flags(store-matches) | ||
); | ||
}; | ||
rewrite{ | ||
r_set_splunk_dest_update( | ||
sourcetype('ibm:datapower:$1') | ||
meta_key("$1") | ||
); | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
application ibm-datapower[sc4s-network-source] { | ||
filter { | ||
( | ||
"${.netsource.sc4s_vendor_product}" eq "ibm_datapower" | ||
or "${SOURCE}" eq "s_IBM_DATAPOWER" | ||
) | ||
}; | ||
parser { ibm-datapower-parser(); }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2019 Splunk, Inc. | ||
# | ||
# Use of this source code is governed by a BSD-2-clause-style | ||
# license that can be found in the LICENSE-BSD2 file or at | ||
# https://opensource.org/licenses/BSD-2-Clause | ||
|
||
from jinja2 import Environment | ||
|
||
from .sendmessage import * | ||
from .splunkutils import * | ||
from .timeutils import * | ||
|
||
import pytest | ||
|
||
env = Environment() | ||
|
||
|
||
testdata = [ | ||
"{{ mark }}{{ bsd }} {{ host }} [APIGWTEBN][0x88c00002][apigw][error] source-https(APIGWTEBN_https_443): trans(3168147)[11.11.11.16]: The request URL 'https://11.11.11.11/' is not routed to any API collection.", | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("event", testdata) | ||
def test_ibm_datapower( | ||
record_property, setup_wordlist, get_host_key, setup_splunk, setup_sc4s, event | ||
): | ||
host = "test-ibmdp-" + get_host_key | ||
|
||
dt = datetime.datetime.now() | ||
iso, bsd, time, date, tzoffset, tzname, epoch = time_operations(dt) | ||
|
||
# Tune time functions | ||
epoch = epoch[:-7] | ||
|
||
mt = env.from_string(event + "\n") | ||
message = mt.render(mark="<166>", bsd=bsd, host=host) | ||
|
||
sendsingle(message, setup_sc4s[0], setup_sc4s[1][514]) | ||
|
||
st = env.from_string( | ||
'search index=infraops _time={{ epoch }} sourcetype="ibm:datapower:apigw" (host="{{ host }}" OR "{{ host }}")' | ||
) | ||
search = st.render(epoch=epoch, host=host) | ||
|
||
resultCount, eventCount = splunk_single(setup_splunk, search) | ||
|
||
record_property("host", host) | ||
record_property("resultCount", resultCount) | ||
record_property("message", message) | ||
|
||
assert resultCount == 1 |