Skip to content

Commit 03162ed

Browse files
author
“deep-splunk”
committed
add track-data config in template
1 parent e7dc741 commit 03162ed

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

test/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def pytest_configure():
6767
('splunk.header.source', b'kafka_custom_header_source'),
6868
('splunk.header.sourcetype', b'kafka_custom_header_sourcetype')]
6969
producer.send(config["kafka_header_topic"], msg, headers=headers_to_send)
70-
producer.send("record_key",{"timestamp": config['timestamp']},bytes("record_key_test", 'utf-8'))
7170
producer.send("test_splunk_hec_malformed_events", {})
7271
producer.send("test_splunk_hec_malformed_events", {"&&": "null", "message": ["$$$$****////", 123, None]})
72+
producer.send("record_key",{"timestamp": config['timestamp']},bytes("record_key_test", 'utf-8'))
7373
protobuf_producer.send("prototopic",value=b'\x00\x00\x00\x00\x01\x00\n\x011\x12\r10-01-04-3:45\x18\x15%\x00\x00*C*\x02No:\x12\n\x011\x12\x04this\x1a\x07New oneB\x0c\n\x011\x12\x07shampooJ\x04Many')
7474
timestamp_producer.send("date_format",b"{\"id\": \"19\",\"host\":\"host-01\",\"source\":\"bu\",\"fields\":{\"hn\":\"hostname\",\"CLASS\":\"class\",\"cust_id\":\"000013934\",\"time\": \"Jun 13 2010 23:11:52.454 UTC\",\"category\":\"IFdata\",\"ifname\":\"LoopBack7\",\"IFdata.Bits received\":\"0\",\"IFdata.Bits sent\":\"0\"}")
7575
timestamp_producer.send("epoch_format",b"{\"id\": \"19\",\"host\":\"host-01\",\"source\":\"bu\",\"fields\":{\"hn\":\"hostname\",\"CLASS\":\"class\",\"cust_id\":\"000013934\",\"time\": \"1555209605000\",\"category\":\"IFdata\",\"ifname\":\"LoopBack7\",\"IFdata.Bits received\":\"0\",\"IFdata.Bits sent\":\"0\"}")

test/lib/connector.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"value.converter.schemas.enable": "{{value_converter_schemas_enable}}",
5151
"enable.timestamp.extraction": "{{enable_timestamp_extraction}}",
5252
"timestamp.regex": "{{timestamp_regex}}",
53-
"timestamp.format": "{{timestamp_format}}"
53+
"timestamp.format": "{{timestamp_format}}",
54+
"splunk.hec.track.data": "{{splunk_hec_track_data}}"
5455
}
5556
}

test/testcases/test_data_enrichment.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,8 @@ def test_record_key_data_enrichment(self, setup, test_scenario, test_input, expe
7373
query=[f"search {search_query}"],
7474
password=setup["splunk_password"])
7575
logger.info("Splunk received %s events in the last hour", len(events))
76-
assert events[0]["fields"]["kafka_record_key"] == expected
76+
77+
if(len(events)==1):
78+
assert events[0]["fields"]["kafka_record_key"] == expected
79+
else:
80+
assert False,"No event found or duplicate events found"

0 commit comments

Comments
 (0)