<?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 splunk hec ingestion of data file in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/splunk-hec-ingestion-of-data-file/m-p/677478#M113259</link>
    <description>&lt;P&gt;Been struggling for a while on this one.&lt;/P&gt;&lt;P&gt;On-prem Splunk Enterprise.&amp;nbsp; v9.1.2, running on CentOS 7.9&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Just trying to find a consistent way to be able to upload log files through HTTP Event Collector (HEC) tokens.&amp;nbsp; I found the whole RAW vs JSON thing confusing at first and thought the only way to be able to specify/override values like host, sourcetype, etc. was to package up my log file in the JSON format.&lt;/P&gt;&lt;P&gt;Discovered today that you can specify those values in the RAW url, like so:&lt;/P&gt;&lt;P&gt;&lt;A href="https://mysplunkinstance.com:8088/services/collector/raw?host=myserver&amp;amp;sourcetype=linux_server" target="_blank" rel="noopener"&gt;https://mysplunkinstance.com:8088/services/collector/raw?host=myserver&amp;amp;sourcetype=linux_server&lt;/A&gt;&lt;/P&gt;&lt;P&gt;which was encouraging.&amp;nbsp; It seemed to work.&lt;/P&gt;&lt;P&gt;And I think I've gotten further ahead.&amp;nbsp; I now have this effectively, as my curl command running in a bash script:&lt;/P&gt;&lt;P&gt;curl -k &lt;A href="https://mysplunkinstance.com:8088/services/collector/raw?host=myserver&amp;amp;sourcetype=linux_server" target="_blank" rel="noopener"&gt;https://mysplunkinstance.com:8088/services/collector/raw?host=myserver&amp;amp;sourcetype=linux_server&lt;/A&gt; -H "Authorization: Splunk &amp;lt;hec_token&amp;gt;" -H "Content-type: plain/text" -X 'POST' -d "@${file}"&lt;/P&gt;&lt;P&gt;Happy to report that I now see the log data.&lt;/P&gt;&lt;P&gt;However, it only seems happy if its a single line log.&amp;nbsp; When I give it a log file with more lines, it just jumbles it all together.&amp;nbsp; I thought it would honour the configuration rules we have programmed for sourcetype=linux_secure (from community add-ons and our own updates) but it doesn't.&amp;nbsp; Loading the same file through Settings -&amp;gt; Add Data has no problem properly line-breaking per the configuration.&lt;/P&gt;&lt;P&gt;I'm guessing there is something I am missing then in how one is meant to send RAW log files through HEC?&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2024 20:18:53 GMT</pubDate>
    <dc:creator>labrat045</dc:creator>
    <dc:date>2024-02-13T20:18:53Z</dc:date>
    <item>
      <title>splunk hec ingestion of data file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/splunk-hec-ingestion-of-data-file/m-p/677478#M113259</link>
      <description>&lt;P&gt;Been struggling for a while on this one.&lt;/P&gt;&lt;P&gt;On-prem Splunk Enterprise.&amp;nbsp; v9.1.2, running on CentOS 7.9&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Just trying to find a consistent way to be able to upload log files through HTTP Event Collector (HEC) tokens.&amp;nbsp; I found the whole RAW vs JSON thing confusing at first and thought the only way to be able to specify/override values like host, sourcetype, etc. was to package up my log file in the JSON format.&lt;/P&gt;&lt;P&gt;Discovered today that you can specify those values in the RAW url, like so:&lt;/P&gt;&lt;P&gt;&lt;A href="https://mysplunkinstance.com:8088/services/collector/raw?host=myserver&amp;amp;sourcetype=linux_server" target="_blank" rel="noopener"&gt;https://mysplunkinstance.com:8088/services/collector/raw?host=myserver&amp;amp;sourcetype=linux_server&lt;/A&gt;&lt;/P&gt;&lt;P&gt;which was encouraging.&amp;nbsp; It seemed to work.&lt;/P&gt;&lt;P&gt;And I think I've gotten further ahead.&amp;nbsp; I now have this effectively, as my curl command running in a bash script:&lt;/P&gt;&lt;P&gt;curl -k &lt;A href="https://mysplunkinstance.com:8088/services/collector/raw?host=myserver&amp;amp;sourcetype=linux_server" target="_blank" rel="noopener"&gt;https://mysplunkinstance.com:8088/services/collector/raw?host=myserver&amp;amp;sourcetype=linux_server&lt;/A&gt; -H "Authorization: Splunk &amp;lt;hec_token&amp;gt;" -H "Content-type: plain/text" -X 'POST' -d "@${file}"&lt;/P&gt;&lt;P&gt;Happy to report that I now see the log data.&lt;/P&gt;&lt;P&gt;However, it only seems happy if its a single line log.&amp;nbsp; When I give it a log file with more lines, it just jumbles it all together.&amp;nbsp; I thought it would honour the configuration rules we have programmed for sourcetype=linux_secure (from community add-ons and our own updates) but it doesn't.&amp;nbsp; Loading the same file through Settings -&amp;gt; Add Data has no problem properly line-breaking per the configuration.&lt;/P&gt;&lt;P&gt;I'm guessing there is something I am missing then in how one is meant to send RAW log files through HEC?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:18:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/splunk-hec-ingestion-of-data-file/m-p/677478#M113259</guid>
      <dc:creator>labrat045</dc:creator>
      <dc:date>2024-02-13T20:18:53Z</dc:date>
    </item>
  </channel>
</rss>

