<?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 Field Extract Syslog Data: How to extract the Syslog Message and KV pairs? in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Field-Extract-Syslog-Data-How-to-extract-the-Syslog-Message-and/m-p/600904#M8845</link>
    <description>&lt;P&gt;I feel I'm getting lost in the sauce. I'm working on creating a props.conf for some syslog data on ingest (not search time) where the syslog message has it's standard syslog content, and then my message will start off with a statement followed by colon delimited fields with new lines. So like this message below. NOTE: the bold "normal" text changes depending on the message type, so this part is dynamic.&lt;/P&gt;
&lt;P&gt;&amp;lt;priority&amp;gt;timestamp data1 data2 this is a &lt;STRONG&gt;normal&lt;/STRONG&gt; message:&lt;BR /&gt;key:val&lt;BR /&gt;key1:val1&lt;BR /&gt;key2:val2&lt;/P&gt;
&lt;P&gt;---&lt;BR /&gt;key_n:val_n&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I want to parse the the first line and pull different values from the syslog message, and then after that just use a delimiter so I don't have to specify each field (because there are a lot of fields, up to 50 different key:value lines).&lt;/P&gt;
&lt;P&gt;First, not sure how to specify to Splunk: parse line 1 one way, and then use a delimiter on every other line. I'm sure there is a way?&lt;/P&gt;
&lt;P&gt;I've looked into attributes for structured data &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.6/Data/Extractfieldsfromfileswithstructureddata#:~:text=Splunk%20universal%20forwarder.-,Props.conf%20attributes%20for%20structured%20data,-To%20configure%20field" target="_blank" rel="noopener"&gt;here&lt;/A&gt;. I want to treat the first line almost like a header (different from the rest of the log), but not like the FIELD_HEADER properties as this isn't a delimited header I'm attempting to extract (like csv data).&lt;/P&gt;
&lt;P&gt;How can I parse just the first line of my syslog (probably with some regex to grab everything appropriately), and then for the rest of my content use the delimiter? Maybe I could use FIELD_DELIMITER=: ? Additionally, I'm thinking I might have to use the transforms DELIM property &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.6/Admin/Transformsconf#:~:text=DELIMS%20%3D%20%3Cquoted%20string%20list%3E" target="_blank" rel="noopener"&gt;here&lt;/A&gt;. I'm thinking something like this:&amp;nbsp;DELIMS = "\r\n", ":"&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jun 2022 05:40:14 GMT</pubDate>
    <dc:creator>spelunkingsplnk</dc:creator>
    <dc:date>2022-06-10T05:40:14Z</dc:date>
    <item>
      <title>Field Extract Syslog Data: How to extract the Syslog Message and KV pairs?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Field-Extract-Syslog-Data-How-to-extract-the-Syslog-Message-and/m-p/600904#M8845</link>
      <description>&lt;P&gt;I feel I'm getting lost in the sauce. I'm working on creating a props.conf for some syslog data on ingest (not search time) where the syslog message has it's standard syslog content, and then my message will start off with a statement followed by colon delimited fields with new lines. So like this message below. NOTE: the bold "normal" text changes depending on the message type, so this part is dynamic.&lt;/P&gt;
&lt;P&gt;&amp;lt;priority&amp;gt;timestamp data1 data2 this is a &lt;STRONG&gt;normal&lt;/STRONG&gt; message:&lt;BR /&gt;key:val&lt;BR /&gt;key1:val1&lt;BR /&gt;key2:val2&lt;/P&gt;
&lt;P&gt;---&lt;BR /&gt;key_n:val_n&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I want to parse the the first line and pull different values from the syslog message, and then after that just use a delimiter so I don't have to specify each field (because there are a lot of fields, up to 50 different key:value lines).&lt;/P&gt;
&lt;P&gt;First, not sure how to specify to Splunk: parse line 1 one way, and then use a delimiter on every other line. I'm sure there is a way?&lt;/P&gt;
&lt;P&gt;I've looked into attributes for structured data &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.6/Data/Extractfieldsfromfileswithstructureddata#:~:text=Splunk%20universal%20forwarder.-,Props.conf%20attributes%20for%20structured%20data,-To%20configure%20field" target="_blank" rel="noopener"&gt;here&lt;/A&gt;. I want to treat the first line almost like a header (different from the rest of the log), but not like the FIELD_HEADER properties as this isn't a delimited header I'm attempting to extract (like csv data).&lt;/P&gt;
&lt;P&gt;How can I parse just the first line of my syslog (probably with some regex to grab everything appropriately), and then for the rest of my content use the delimiter? Maybe I could use FIELD_DELIMITER=: ? Additionally, I'm thinking I might have to use the transforms DELIM property &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.6/Admin/Transformsconf#:~:text=DELIMS%20%3D%20%3Cquoted%20string%20list%3E" target="_blank" rel="noopener"&gt;here&lt;/A&gt;. I'm thinking something like this:&amp;nbsp;DELIMS = "\r\n", ":"&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 05:40:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Field-Extract-Syslog-Data-How-to-extract-the-Syslog-Message-and/m-p/600904#M8845</guid>
      <dc:creator>spelunkingsplnk</dc:creator>
      <dc:date>2022-06-10T05:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extract Syslog Data: Extract the Syslog Message and KV pairs</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Field-Extract-Syslog-Data-How-to-extract-the-Syslog-Message-and/m-p/601079#M8854</link>
      <description>&lt;P&gt;Figured it out with the help of &lt;A href="https://community.splunk.com/t5/Splunk-Search/Using-DELIMS-to-extract-FIX-data/m-p/14309#:~:text=So%2C%20perhaps%20you%20would%20end%20up%20with%20something%20like%20this" target="_blank" rel="noopener"&gt;this post:&amp;nbsp;&lt;SPAN&gt;Using DELIMS to extract FIX data&lt;/SPAN&gt;&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I created a props to extract fields on search-time. This allows me to extract all the fields on my first line of data.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;[sourcetypeInfo]&lt;BR /&gt;EXTRACT-syslogmsg = ^&amp;lt;(?&amp;lt;priority&amp;gt;[\d]+)&amp;gt;(?&amp;lt;timestamp&amp;gt;[a-zA-Z]{3}\s\s?[\d]{1,2}\sthis is a\s(?&amp;lt;message_type&amp;gt;[a-zA-Z]+)\sseverity:[\r\n\s]+(?&amp;lt;key_value_list&amp;gt;.*)&lt;BR /&gt;REPORT-syslog_key_value_list = syslog_key_value_list&lt;/PRE&gt;&lt;P&gt;Within my EXTRACT, I want to grab all the field I care about, as well as all the key-value pairs in it's own field. To separate my key-value pairs, I use a group name called key_value_list (located at the very end of my EXTRACT-syslogmsg) which I will use in my transforms.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;[syslog_key_value_list]&lt;BR /&gt;SOURCE_KEY = key_value_list&lt;BR /&gt;DELIMS = "\r\n", ":"&lt;/PRE&gt;&lt;P&gt;This is how it all comes together. In my transforms, I use the SOURCE_KEY to inform Splunk what Key (aka field) will be used. At this point, we can simply use the DELIMS property.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 20:04:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Field-Extract-Syslog-Data-How-to-extract-the-Syslog-Message-and/m-p/601079#M8854</guid>
      <dc:creator>spelunkingsplnk</dc:creator>
      <dc:date>2022-06-08T20:04:49Z</dc:date>
    </item>
  </channel>
</rss>

