-
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: support solace event broker (#1419)
fixes #1405
- Loading branch information
Ryan Faircloth
authored
Jan 31, 2022
1 parent
083c70e
commit 988eea2
Showing
4 changed files
with
118 additions
and
0 deletions.
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,47 @@ | ||
# Vendor - Solace | ||
|
||
|
||
## Product - EventBroker | ||
|
||
| Ref | Link | | ||
|----------------|---------------------------------------------------------------------------------------------------------| | ||
| Splunk Add-on | None | | ||
| Product Manual | unknown | | ||
|
||
|
||
### Sourcetypes | ||
|
||
| sourcetype | notes | | ||
|----------------|---------------------------------------------------------------------------------------------------------| | ||
| solace:eventbroker | None | | ||
|
||
### Sourcetype and Index Configuration | ||
|
||
| key | sourcetype | index | notes | | ||
|----------------|----------------|----------------|----------------| | ||
| solace_eventbroker | solace:eventbroker | main | none | | ||
|
||
### Filter type | ||
|
||
MSGPARSE: | ||
|
||
### Setup and Configuration | ||
|
||
Device setup unknown | ||
|
||
### Options | ||
|
||
| Variable | default | description | | ||
|----------------|----------------|----------------| | ||
| SC4S_LISTEN_SOLACE_EVENTBROKER_TCP_PORT | empty string | Enable a TCP port for this specific vendor product using a comma-separated list of port numbers | | ||
| SC4S_LISTEN_SOLACE_EVENTBROKER_UDP_PORT | empty string | Enable a UDP port for this specific vendor product using a comma-separated list of port numbers | | ||
| SC4S_ARCHIVE_SOLACE_EVENTBROKER | no | Enable archive to disk for this specific source | | ||
| SC4S_DEST_SOLACE_EVENTBROKER_HEC | no | When Splunk HEC is disabled globally set to yes to enable this specific source | | ||
|
||
### Verification | ||
|
||
An active device will generate frequent events. Use the following search to validate events are present per source device | ||
|
||
``` | ||
index=<asconfigured> sourcetype=solace:eventbroker | stats count by host | ||
``` |
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
24 changes: 24 additions & 0 deletions
24
package/etc/conf.d/conflib/syslog/app-syslog-solace_eventbroker.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,24 @@ | ||
block parser app-syslog-solace_eventbroker() { | ||
channel { | ||
# | ||
rewrite { | ||
r_set_splunk_dest_default( | ||
index('main') | ||
sourcetype('solace:eventbroker') | ||
vendor_product("solace_eventbroker") | ||
); | ||
}; | ||
|
||
|
||
}; | ||
}; | ||
application app-syslog-solace_eventbroker[sc4s-syslog] { | ||
filter { | ||
program('^event') | ||
and message('^SYSTEM: [A-Z]+'); | ||
}; | ||
parser { app-syslog-solace_eventbroker(); }; | ||
}; | ||
|
||
|
||
|
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 @@ | ||
# 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 | ||
import random | ||
|
||
from jinja2 import Environment | ||
|
||
from .sendmessage import * | ||
from .splunkutils import * | ||
from .timeutils import * | ||
|
||
env = Environment() | ||
|
||
# <158>Nov 11 15:22:22 xx-09 event: SYSTEM: SYSTEM_CLIENT_CONNECT_FAIL: - - Message VPN (xx) Sol Client username xx clientname xx@RTMD_ALL connect failed from 10.0.0.0:33454 - Forbidden: Client Name Already In Use | ||
|
||
|
||
def test_solace(record_property, setup_wordlist, setup_splunk, setup_sc4s): | ||
host = "{}-{}".format(random.choice(setup_wordlist), random.choice(setup_wordlist)) | ||
|
||
dt = datetime.datetime.now() | ||
iso, bsd, time, date, tzoffset, tzname, epoch = time_operations(dt) | ||
|
||
# Tune time functions | ||
epoch = epoch[:-7] | ||
|
||
mt = env.from_string( | ||
"{{ mark }}{{ bsd }}{{ host }} event: SYSTEM: SYSTEM_CLIENT_CONNECT_FAIL: - - Message VPN (xx) Sol Client username xx clientname xx@RTMD_ALL connect failed from 10.0.0.0:33454 - Forbidden: Client Name Already In Use\n" | ||
) | ||
message = mt.render(mark="<111>", bsd=bsd, host=host, epoch=epoch) | ||
|
||
sendsingle(message, setup_sc4s[0], setup_sc4s[1][514]) | ||
|
||
st = env.from_string( | ||
'search _time={{ epoch }} index=main host="{{ host }}" sourcetype="solace:eventbroker"' | ||
) | ||
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 |