Skip to content
This repository has been archived by the owner. It is now read-only.

Commit 9a7748c

Browse files
authored
Merge pull request #44 from HubbleStack/develop
Merge to master (prep for v2016.10.4)
2 parents 20192a2 + 09a1610 commit 9a7748c

File tree

6 files changed

+158
-19
lines changed

6 files changed

+158
-19
lines changed

FORMULA

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: hubblestack_quasar
22
os: RedHat, CentOS, Debian, Ubuntu
33
os_family: RedHat, Debian
4-
version: 2016.9.0
4+
version: 2016.10.4
55
release: 1
66
summary: HubbleStack Quasar
77
description: HubbleStack Quasar

README.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ repo for updates and bugfixes!)
4848

4949
.. code-block:: shell
5050
51-
wget https://spm.hubblestack.io/quasar/hubblestack_quasar-2016.10.3-1.spm
52-
spm local install hubblestack_quasar-2016.10.3-1.spm
51+
wget https://spm.hubblestack.io/quasar/hubblestack_quasar-2016.10.4-1.spm
52+
spm local install hubblestack_quasar-2016.10.4-1.spm
5353
5454
You should now be able to sync the new modules to your minion(s) using the
5555
``sync_returners`` Salt utility:
@@ -106,6 +106,25 @@ Target the ``hubblestack_quasar.sls`` extension and target it to selected minion
106106
107107
Once these modules are synced you'll be ready to begin reporting data and events.
108108

109+
Installation (GitFS)
110+
--------------------
111+
112+
This installation method subscribes directly to our GitHub repository, pinning
113+
to a tag or branch. This method requires no package installation or manual
114+
checkouts.
115+
116+
Requirements: GitFS support on your Salt Master.
117+
118+
**/etc/salt/master.d/hubblestack-quasar.conf**
119+
120+
.. code-block:: diff
121+
122+
gitfs_remotes:
123+
- https://github.com/hubblestack/quasar:
124+
- base: v2016.10.4
125+
126+
.. tip:: Remember to restart the Salt Master after applying this change.
127+
109128
.. _quasar_usage:
110129

111130
Usage

_returners/slack_pulsar_returner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
# Import Salt Libs
7070
import salt.returners
7171

72-
__version__ = 'v2016.10.3'
72+
__version__ = 'v2016.10.4'
7373

7474
log = logging.getLogger(__name__)
7575

_returners/splunk_nebula_return.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
HubbleStack Nebula-to-Splunk returner
44
55
:maintainer: HubbleStack
6-
:maturity: 2016.7.0
6+
:maturity: 2016.10.4
77
:platform: All
88
:requires: SaltStack
99
@@ -20,6 +20,26 @@
2020
indexer: <hostname/IP of Splunk indexer>
2121
sourcetype: <Destination sourcetype for data>
2222
index: <Destination index for data>
23+
24+
You can also add an `custom_fields` argument which is a list of keys to add to events
25+
with using the results of config.get(<custom_field>). These new keys will be prefixed
26+
with 'custom_' to prevent conflicts. The values of these keys should be
27+
strings or lists (will be sent as CSV string), do not choose grains or pillar values with complex values or they will
28+
be skipped:
29+
30+
.. code-block:: yaml
31+
32+
hubblestack:
33+
nebula:
34+
returner:
35+
splunk:
36+
token: <splunk_http_forwarder_token>
37+
indexer: <hostname/IP of Splunk indexer>
38+
sourcetype: <Destination sourcetype for data>
39+
index: <Destination index for data>
40+
custom_fields:
41+
- site
42+
- product_group
2343
'''
2444
import socket
2545

@@ -30,7 +50,7 @@
3050

3151
import logging
3252

33-
__version__ = 'v2016.10.3'
53+
__version__ = 'v2016.10.4'
3454

3555
_max_content_bytes = 100000
3656
http_event_collector_SSL_verify = False
@@ -51,6 +71,7 @@ def returner(ret):
5171
hec_ssl = opts['http_event_server_ssl']
5272
proxy = opts['proxy']
5373
timeout = opts['timeout']
74+
custom_fields = opts['custom_fields']
5475
# Set up the collector
5576
hec = http_event_collector(http_event_collector_key, http_event_collector_host, http_event_server_ssl=hec_ssl, proxy=proxy, timeout=timeout)
5677

@@ -80,6 +101,16 @@ def returner(ret):
80101
event.update({'minion_id': minion_id})
81102
event.update({'dest_host': fqdn})
82103
event.update({'dest_ip': fqdn_ip4})
104+
105+
for custom_field in custom_fields:
106+
custom_field_name = 'custom_' + custom_field
107+
custom_field_value = __salt__['config.get'](custom_field, '')
108+
if isinstance(custom_field_value, str):
109+
event.update({custom_field_name: custom_field_value})
110+
elif isinstance(custom_field_value, list):
111+
custom_field_value = ','.join(custom_field_value)
112+
event.update({custom_field_name: custom_field_value})
113+
83114
payload.update({'host': fqdn})
84115
payload.update({'index': opts['index']})
85116
payload.update({'sourcetype': opts['sourcetype']})
@@ -96,9 +127,10 @@ def _get_options():
96127
indexer = __salt__['config.get']('hubblestack:nebula:returner:splunk:indexer')
97128
sourcetype = __salt__['config.get']('hubblestack:nebula:returner:splunk:sourcetype')
98129
index = __salt__['config.get']('hubblestack:nebula:returner:splunk:index')
130+
custom_fields = __salt__['config.get']('hubblestack:nebula:returner:splunk:custom_fields', [])
99131
except:
100132
return None
101-
splunk_opts = {'token': token, 'indexer': indexer, 'sourcetype': sourcetype, 'index': index}
133+
splunk_opts = {'token': token, 'indexer': indexer, 'sourcetype': sourcetype, 'index': index, 'custom_fields': custom_fields}
102134

103135
hec_ssl = __salt__['config.get']('hubblestack:nebula:returner:splunk:hec_ssl', True)
104136
splunk_opts['http_event_server_ssl'] = hec_ssl

_returners/splunk_nova_return.py

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
HubbleStack Nova-to-Splunk returner
44
55
:maintainer: HubbleStack
6-
:maturity: 2016.7.0
6+
:maturity: 2016.10.4
77
:platform: All
88
:requires: SaltStack
99
@@ -20,6 +20,26 @@
2020
indexer: <hostname/IP of Splunk indexer>
2121
sourcetype: <Destination sourcetype for data>
2222
index: <Destination index for data>
23+
24+
You can also add an `custom_fields` argument which is a list of keys to add to events
25+
with using the results of config.get(<custom_field>). These new keys will be prefixed
26+
with 'custom_' to prevent conflicts. The values of these keys should be
27+
strings, do not choose grains or pillar values with complex values or they will
28+
be skipped:
29+
30+
.. code-block:: yaml
31+
32+
hubblestack:
33+
nova:
34+
returner:
35+
splunk:
36+
token: <splunk_http_forwarder_token>
37+
indexer: <hostname/IP of Splunk indexer>
38+
sourcetype: <Destination sourcetype for data>
39+
index: <Destination index for data>
40+
custom_fields:
41+
- site
42+
- product_group
2343
'''
2444
import socket
2545

@@ -30,7 +50,7 @@
3050

3151
import logging
3252

33-
__version__ = 'v2016.10.3'
53+
__version__ = 'v2016.10.4'
3454

3555
_max_content_bytes = 100000
3656
http_event_collector_SSL_verify = False
@@ -50,6 +70,7 @@ def returner(ret):
5070
hec_ssl = opts['http_event_server_ssl']
5171
proxy = opts['proxy']
5272
timeout = opts['timeout']
73+
custom_fields = opts['custom_fields']
5374
# Set up the collector
5475
hec = http_event_collector(http_event_collector_key, http_event_collector_host, http_event_server_ssl=hec_ssl, proxy=proxy, timeout=timeout)
5576
# st = 'salt:hubble:nova'
@@ -85,6 +106,16 @@ def returner(ret):
85106
event.update({'minion_id': minion_id})
86107
event.update({'dest_host': fqdn})
87108
event.update({'dest_ip': fqdn_ip4})
109+
110+
for custom_field in custom_fields:
111+
custom_field_name = 'custom_' + custom_field
112+
custom_field_value = __salt__['config.get'](custom_field, '')
113+
if isinstance(custom_field_value, str):
114+
event.update({custom_field_name: custom_field_value})
115+
elif isinstance(custom_field_value, list):
116+
custom_field_value = ','.join(custom_field_value)
117+
event.update({custom_field_name: custom_field_value})
118+
88119
payload.update({'host': fqdn})
89120
payload.update({'index': opts['index']})
90121
payload.update({'sourcetype': opts['sourcetype']})
@@ -95,18 +126,30 @@ def returner(ret):
95126
check_id = suc.keys()[0]
96127
payload = {}
97128
event = {}
98-
event.update({'minion_id': minion_id})
99129
event.update({'check_result': 'Success'})
100130
event.update({'check_id': check_id})
101131
event.update({'job_id': jid})
102-
event.update({'master': master})
103132
if not isinstance(suc[check_id], dict):
104133
event.update({'description': suc[check_id]})
105134
elif 'description' in suc[check_id]:
106135
for key, value in suc[check_id].iteritems():
107136
if key not in ['tag']:
108137
event[key] = value
109-
payload.update({'host': minion_id})
138+
event.update({'master': master})
139+
event.update({'minion_id': minion_id})
140+
event.update({'dest_host': fqdn})
141+
event.update({'dest_ip': fqdn_ip4})
142+
143+
for custom_field in custom_fields:
144+
custom_field_name = 'custom_' + custom_field
145+
custom_field_value = __salt__['config.get'](custom_field, '')
146+
if isinstance(custom_field_value, str):
147+
event.update({custom_field_name: custom_field_value})
148+
elif isinstance(custom_field_value, list):
149+
custom_field_value = ','.join(custom_field_value)
150+
event.update({custom_field_name: custom_field_value})
151+
152+
payload.update({'host': fqdn})
110153
payload.update({'sourcetype': opts['sourcetype']})
111154
payload.update({'index': opts['index']})
112155
payload.update({'event': event})
@@ -115,11 +158,23 @@ def returner(ret):
115158
if data.get('Compliance', None):
116159
payload = {}
117160
event = {}
118-
event.update({'minion_id': minion_id})
119161
event.update({'job_id': jid})
120-
event.update({'master': master})
121162
event.update({'compliance_percentage': data['Compliance']})
122-
payload.update({'host': minion_id})
163+
event.update({'master': master})
164+
event.update({'minion_id': minion_id})
165+
event.update({'dest_host': fqdn})
166+
event.update({'dest_ip': fqdn_ip4})
167+
168+
for custom_field in custom_fields:
169+
custom_field_name = 'custom_' + custom_field
170+
custom_field_value = __salt__['config.get'](custom_field, '')
171+
if isinstance(custom_field_value, str):
172+
event.update({custom_field_name: custom_field_value})
173+
elif isinstance(custom_field_value, list):
174+
custom_field_value = ','.join(custom_field_value)
175+
event.update({custom_field_name: custom_field_value})
176+
177+
payload.update({'host': fqdn})
123178
payload.update({'sourcetype': opts['sourcetype']})
124179
payload.update({'index': opts['index']})
125180
payload.update({'event': event})
@@ -154,9 +209,10 @@ def _get_options():
154209
indexer = __salt__['config.get']('hubblestack:nova:returner:splunk:indexer')
155210
sourcetype = __salt__['config.get']('hubblestack:nova:returner:splunk:sourcetype')
156211
index = __salt__['config.get']('hubblestack:nova:returner:splunk:index')
212+
custom_fields = __salt__['config.get']('hubblestack:nebula:returner:splunk:custom_fields', [])
157213
except:
158214
return None
159-
splunk_opts = {'token': token, 'indexer': indexer, 'sourcetype': sourcetype, 'index': index}
215+
splunk_opts = {'token': token, 'indexer': indexer, 'sourcetype': sourcetype, 'index': index, 'custom_fields': custom_fields}
160216

161217
hec_ssl = __salt__['config.get']('hubblestack:nova:returner:splunk:hec_ssl', True)
162218
splunk_opts['http_event_server_ssl'] = hec_ssl

_returners/splunk_pulsar_return.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
HubbleStack Pulsar-to-Splunk returner
44
55
:maintainer: HubbleStack
6-
:maturity: 2016.7.0
6+
:maturity: 2016.10.4
77
:platform: All
88
:requires: SaltStack
99
@@ -20,6 +20,26 @@
2020
indexer: <hostname/IP of Splunk indexer>
2121
sourcetype: <Destination sourcetype for data>
2222
index: <Destination index for data>
23+
24+
You can also add an `custom_fields` argument which is a list of keys to add to events
25+
with using the results of config.get(<custom_field>). These new keys will be prefixed
26+
with 'custom_' to prevent conflicts. The values of these keys should be
27+
strings, do not choose grains or pillar values with complex values or they will
28+
be skipped:
29+
30+
.. code-block:: yaml
31+
32+
hubblestack:
33+
pulsar:
34+
returner:
35+
splunk:
36+
token: <splunk_http_forwarder_token>
37+
indexer: <hostname/IP of Splunk indexer>
38+
sourcetype: <Destination sourcetype for data>
39+
index: <Destination index for data>
40+
custom_fields:
41+
- site
42+
- product_group
2343
'''
2444

2545
import socket
@@ -33,7 +53,7 @@
3353

3454
import logging
3555

36-
__version__ = 'v2016.10.3'
56+
__version__ = 'v2016.10.4'
3757

3858
_max_content_bytes = 100000
3959
http_event_collector_SSL_verify = False
@@ -53,6 +73,7 @@ def returner(ret):
5373
hec_ssl = opts['http_event_server_ssl']
5474
proxy = opts['proxy']
5575
timeout = opts['timeout']
76+
custom_fields = opts['custom_fields']
5677
# Set up the collector
5778
hec = http_event_collector(http_event_collector_key, http_event_collector_host, http_event_server_ssl=hec_ssl, proxy=proxy, timeout=timeout)
5879
# Check whether or not data is batched:
@@ -164,6 +185,16 @@ def returner(ret):
164185
event.update({'minion_id': minion_id})
165186
event.update({'dest_host': fqdn})
166187
event.update({'dest_ip': fqdn_ip4})
188+
189+
for custom_field in custom_fields:
190+
custom_field_name = 'custom_' + custom_field
191+
custom_field_value = __salt__['config.get'](custom_field, '')
192+
if isinstance(custom_field_value, str):
193+
event.update({custom_field_name: custom_field_value})
194+
elif isinstance(custom_field_value, list):
195+
custom_field_value = ','.join(custom_field_value)
196+
event.update({custom_field_name: custom_field_value})
197+
167198
payload.update({'host': fqdn})
168199
payload.update({'index': opts['index']})
169200
payload.update({'sourcetype': opts['sourcetype']})
@@ -188,9 +219,10 @@ def _get_options():
188219
indexer = __salt__['config.get']('hubblestack:pulsar:returner:splunk:indexer')
189220
sourcetype = __salt__['config.get']('hubblestack:pulsar:returner:splunk:sourcetype')
190221
index = __salt__['config.get']('hubblestack:pulsar:returner:splunk:index')
222+
custom_fields = __salt__['config.get']('hubblestack:nebula:returner:splunk:custom_fields', [])
191223
except:
192224
return None
193-
splunk_opts = {'token': token, 'indexer': indexer, 'sourcetype': sourcetype, 'index': index}
225+
splunk_opts = {'token': token, 'indexer': indexer, 'sourcetype': sourcetype, 'index': index, 'custom_fields': custom_fields}
194226

195227
hec_ssl = __salt__['config.get']('hubblestack:pulsar:returner:splunk:hec_ssl', True)
196228
splunk_opts['http_event_server_ssl'] = hec_ssl

0 commit comments

Comments
 (0)