Last active
May 31, 2016 21:30
-
-
Save tmuth/eb0efd47a1cbbb531a495dc676c3d2d9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
create or replace procedure log_splunk_plugin( | |
p_rec in logger.rec_logger_log) | |
as | |
l_text logger_logs.text%type; | |
l_module varchar2(50); | |
v_body CLOB; | |
v_result CLOB; | |
l_splunk_hec_token varchar2(64) := 'F3C63E53-1EDA-4DF4-80F8-6BD5B047069A'; | |
begin | |
dbms_output.put_line('In Plugin'); | |
dbms_output.put_line('p_rec.id: ' || p_rec.id); | |
select regexp_replace(text,'[[:cntrl:]]',''),module | |
into l_text,l_module | |
from logger_logs_5_min | |
where id = p_rec.id; | |
dbms_output.put_line('Text: ' || l_text); | |
apex_web_service.g_request_headers(1).name := 'Authorization'; | |
apex_web_service.g_request_headers(1).value := 'Splunk '||l_splunk_hec_token; | |
v_body := '{"event": { "logger_text": "'|| l_text ||'", | |
"id": "'||p_rec.id||'", | |
"module": "'||l_module||'"}}'; | |
v_result := apex_web_service.make_rest_request( | |
p_url => 'http://splunk-local:8088/services/collector' | |
,p_http_method => 'POST' | |
,p_body => v_body | |
); | |
dbms_output.put_line(v_body); | |
dbms_output.put_line(v_result); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.