<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Splunk CSC - Output Debug Logs to Search Log (Not as Log Level: ERROR) in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616403#M10799</link>
    <description>&lt;P&gt;That code stinks, it disables the search bar in a normal Splunk search. I had to modify it:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function cleanCustom() {
    window.cleanCustomGiveUpOn--;
    if (window.cleanCustomGiveUpOn &amp;lt;= 0) {
        clearInterval(window.cleanCustomInterval);
        return;
    }
    var log_text = document.getElementsByTagName("pre");
    if (log_text.length == 0) { return; }
    console.log("cleaning custom...");
	var log_text = log_text[0];
	var log_lines = log_text.innerHTML.split('\n');
	var pointless = true;
	for (var i = 0; i &amp;lt; log_lines.length; i++) {
		var line = log_lines[i];
		if (line.includes("ChunkedExternProcessor")) {
			line = line.replace("ERROR ChunkedExternProcessor ", "");
			line = line.replace(" ChunkedExternProcessorStderrLogger] - stderr:", "]");
			log_lines[i] = line;
			pointless = false;
		}
	}
	if (!pointless) {
	  log_text.innerHTML = log_lines.join("\n");
	}
  clearInterval(window.cleanCustomInterval);
}

window.cleanCustomGiveUpOn = 30;
window.cleanCustomInterval = setInterval(cleanCustom, 500);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And again, this entire thing is only for aesthetics and only for looking at live debug logs from csc development. I don't know why I care so much about something that probably less than millionth of the human population will ever even come close to sympathizing with.&lt;/P&gt;</description>
    <pubDate>Sat, 08 Oct 2022 03:17:19 GMT</pubDate>
    <dc:creator>jocobwknight</dc:creator>
    <dc:date>2022-10-08T03:17:19Z</dc:date>
    <item>
      <title>Splunk CSC - Output Debug Logs to Search Log (Not as Log Level: ERROR)</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616397#M10793</link>
      <description>&lt;P&gt;I'm working on a Splunk CSC and I've found it really helpful to output logs to the search log with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;print('Whatever I want', file=sys.stderr)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which appears in the search log as:&lt;/P&gt;&lt;PRE&gt;10-07-2022 23:47:19.915 ERROR ChunkedExternProcessor [10374 ChunkedExternProcessorStderrLogger] - stderr: Whatever I want&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But that's a very beefy (even misleading) preamble. So my question is: &lt;STRONG&gt;Can I control the output that gets displayed in the search log?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm assuming there's some file handle somewhere I can write to and I would&amp;nbsp;&lt;EM&gt;love&lt;/EM&gt; to get a hold of it! It's obviously not sys.stdout because that's what the actual event data gets transmitted to.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 23:53:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616397#M10793</guid>
      <dc:creator>jocobwknight</dc:creator>
      <dc:date>2022-10-07T23:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk CSC - Output Debug Logs to Search Log (Not as Log Level: ERROR)</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616398#M10794</link>
      <description>&lt;P&gt;You can control the log message by using a log formatter.&amp;nbsp; See&amp;nbsp;&lt;A href="https://dev.splunk.com/enterprise/docs/developapps/manageknowledge/custominputs/modinputsscript/#Set-up-logging" target="_blank"&gt;https://dev.splunk.com/enterprise/docs/developapps/manageknowledge/custominputs/modinputsscript/#Set-up-logging&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 00:13:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616398#M10794</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-10-08T00:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk CSC - Output Debug Logs to Search Log (Not as Log Level: ERROR)</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616399#M10795</link>
      <description>&lt;P&gt;This looks like what I need, thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 00:16:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616399#M10795</guid>
      <dc:creator>jocobwknight</dc:creator>
      <dc:date>2022-10-08T00:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk CSC - Output Debug Logs to Search Log (Not as Log Level: ERROR)</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616400#M10796</link>
      <description>&lt;P&gt;Although this is for scripted inputs rather than custom search commands, I'm really hoping Splunk's engine was built to handle both processes in the same way. It seems likely because they've also set it up to log stderr, so I'm optimistic.&lt;/P&gt;&lt;P&gt;(And if it doesn't work, then I can at least assume it's hopeless and stop worrying about the format)&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 00:21:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616400#M10796</guid>
      <dc:creator>jocobwknight</dc:creator>
      <dc:date>2022-10-08T00:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk CSC - Output Debug Logs to Search Log (Not as Log Level: ERROR)</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616401#M10797</link>
      <description>&lt;P&gt;Unfortunately it would seem like this isn't possible after all. I tested&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;'s suggestion by following the Splunk development guide:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import logging

logging.root
logging.root.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - MyCommand [%(levelname)s] %(message)s')
handler = logging.StreamHandler(stream=sys.stderr)
handler.setFormatter(formatter)
logging.root.addHandler(handler)

# CSC stuff...
logging.info('Whatever I want')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And my output was a humorous surprise:&lt;/P&gt;&lt;PRE&gt;10-08-2022 00:38:32.400 ERROR ChunkedExternProcessor [16402 ChunkedExternProcessorStderrLogger] - stderr: 2022-10-07 16:38:32,400 - MyCommand [INFO] Whatever I want&lt;/PRE&gt;&lt;P&gt;But I can at least put my mind at ease now that I've at least&amp;nbsp;&lt;EM&gt;tried&lt;/EM&gt; to make it better.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 00:44:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616401#M10797</guid>
      <dc:creator>jocobwknight</dc:creator>
      <dc:date>2022-10-08T00:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk CSC - Output Debug Logs to Search Log (Not as Log Level: ERROR)</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616402#M10798</link>
      <description>&lt;P&gt;If anyone is like me and would be perfectly happy with a very ugly, shameless solution, then they can manipulate the page rather than Splunk.&lt;/P&gt;&lt;P&gt;For example, I use a Chrome add-on called "Custom JavaScript for Websites 2." It lets me save JavaScript that gets run when a page-pattern loads. The script I'm running is this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function cleanCustom() {
    window.cleanCustomGiveUpOn--;
    if (window.cleanCustomGiveUpOn &amp;lt;= 0) {
        clearInterval(window.cleanCustomInterval);
        return;
    }
    var log_text = document.getElementsByTagName("pre");
    if (log_text.length == 0) { return; }
    console.log("cleaning custom...");
	var log_text = log_text[0];
	var log_lines = log_text.innerHTML.split('\n');
	for (var i = 0; i &amp;lt; log_lines.length; i++) {
		var line = log_lines[i];
		if (line.includes("ChunkedExternProcessor")) {
			line = line.replace("ERROR ChunkedExternProcessor ", "");
			line = line.replace(" ChunkedExternProcessorStderrLogger] - stderr:", "]");
			log_lines[i] = line;
		}
	}
	log_text.innerHTML = log_lines.join("\n");
    clearInterval(window.cleanCustomInterval);
}

window.cleanCustomGiveUpOn = 30;
window.cleanCustomInterval = setInterval(cleanCustom, 500);&lt;/LI-CODE&gt;&lt;P&gt;It looks for the pre that contains the search log for 15 seconds, and upon finding it will scrub out the stuff I don't want.&lt;/P&gt;&lt;P&gt;Not a pretty solution, but an ugly solution for ugly logs seems oddly symmetrical.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 01:14:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616402#M10798</guid>
      <dc:creator>jocobwknight</dc:creator>
      <dc:date>2022-10-08T01:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk CSC - Output Debug Logs to Search Log (Not as Log Level: ERROR)</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616403#M10799</link>
      <description>&lt;P&gt;That code stinks, it disables the search bar in a normal Splunk search. I had to modify it:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function cleanCustom() {
    window.cleanCustomGiveUpOn--;
    if (window.cleanCustomGiveUpOn &amp;lt;= 0) {
        clearInterval(window.cleanCustomInterval);
        return;
    }
    var log_text = document.getElementsByTagName("pre");
    if (log_text.length == 0) { return; }
    console.log("cleaning custom...");
	var log_text = log_text[0];
	var log_lines = log_text.innerHTML.split('\n');
	var pointless = true;
	for (var i = 0; i &amp;lt; log_lines.length; i++) {
		var line = log_lines[i];
		if (line.includes("ChunkedExternProcessor")) {
			line = line.replace("ERROR ChunkedExternProcessor ", "");
			line = line.replace(" ChunkedExternProcessorStderrLogger] - stderr:", "]");
			log_lines[i] = line;
			pointless = false;
		}
	}
	if (!pointless) {
	  log_text.innerHTML = log_lines.join("\n");
	}
  clearInterval(window.cleanCustomInterval);
}

window.cleanCustomGiveUpOn = 30;
window.cleanCustomInterval = setInterval(cleanCustom, 500);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And again, this entire thing is only for aesthetics and only for looking at live debug logs from csc development. I don't know why I care so much about something that probably less than millionth of the human population will ever even come close to sympathizing with.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 03:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-CSC-Output-Debug-Logs-to-Search-Log-Not-as-Log-Level/m-p/616403#M10799</guid>
      <dc:creator>jocobwknight</dc:creator>
      <dc:date>2022-10-08T03:17:19Z</dc:date>
    </item>
  </channel>
</rss>

