<?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: What is the best custom log event format for Splunk to eat? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12509#M1030</link>
    <description>&lt;P&gt;The optimal log format is - &lt;/P&gt;

&lt;P&gt;timestamp key=value key=value key=value key=value key=value key=value key=value key=value &lt;/P&gt;

&lt;P&gt;You can have other delimiters in there too like , or : but that's pretty much a personal preference.  If the keys and values are easily recognizable, Splunk will index and search as fast as you can write it out.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Apr 2010 04:28:19 GMT</pubDate>
    <dc:creator>Mick</dc:creator>
    <dc:date>2010-04-29T04:28:19Z</dc:date>
    <item>
      <title>What is the best custom log event format for Splunk to eat?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12508#M1029</link>
      <description>&lt;P&gt;I intend modify my app/script so that it will write out a completely custom log file format for Splunk to monitor and index in real-time.&lt;/P&gt;

&lt;P&gt;What is the best, most optimal format to use for my custom log event such that Splunk automatically extracts ALL of my fields and the timestamp and I do not have to setup or configure any field extractions myself.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2010 03:45:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12508#M1029</guid>
      <dc:creator>maverick</dc:creator>
      <dc:date>2010-04-29T03:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best custom log event format for Splunk to eat?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12509#M1030</link>
      <description>&lt;P&gt;The optimal log format is - &lt;/P&gt;

&lt;P&gt;timestamp key=value key=value key=value key=value key=value key=value key=value key=value &lt;/P&gt;

&lt;P&gt;You can have other delimiters in there too like , or : but that's pretty much a personal preference.  If the keys and values are easily recognizable, Splunk will index and search as fast as you can write it out.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2010 04:28:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12509#M1030</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2010-04-29T04:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best custom log event format for Splunk to eat?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12510#M1031</link>
      <description>&lt;P&gt;Hello Mick.
Could you share a log format example? What is the timestamp format?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2011 02:08:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12510#M1031</guid>
      <dc:creator>juansh2809</dc:creator>
      <dc:date>2011-04-14T02:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best custom log event format for Splunk to eat?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12511#M1032</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;

&lt;P&gt;Generic Example:&lt;/P&gt;

&lt;P&gt;[Timestamp] Hostname HostIP=IPaddress Service=ServiceName ClientIP=IPaddress SrcPor=port# DestPort=port# UID=value Stuff=blah Morestuff=blahblah&lt;/P&gt;

&lt;P&gt;Specific Example:&lt;/P&gt;

&lt;P&gt;May 26 18:14:15 myhostname HostIP=10.5.10.2 Service=CustomLogger ClientIP=75.149.38.65 SrcPort=80 DestPort=8080 UID=10534 ImportantValue=Be9r87 AnotherImportantValue=310984&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2011 23:18:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12511#M1032</guid>
      <dc:creator>MillerTime</dc:creator>
      <dc:date>2011-05-31T23:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best custom log event format for Splunk to eat?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12512#M1033</link>
      <description>&lt;P&gt;The time stamp should be in ISO8601 form - i.e. variants of YYYY-MM-DD HH:MM:SS.mmm TZ DST.&lt;/P&gt;

&lt;P&gt;Example: 2011-10-24 14:04:02 +0200 DST&lt;/P&gt;

&lt;P&gt;If you do not want (or need) the time zone of Daylight Savings Time designators - these may be omitted.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2011 09:08:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12512#M1033</guid>
      <dc:creator>RubenOlsen</dc:creator>
      <dc:date>2011-10-24T09:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best custom log event format for Splunk to eat?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12513#M1034</link>
      <description>&lt;P&gt;What if you want log sql commands like this:&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;May 26 18:14:15 myhostname DBIP=10.5.10.2 Service=OracleXE ClientIP=75.149.38.65 SrcPort=80 DestPort=8080 UID=10534 &lt;STRONG&gt;Sql_Text=Select * from Table1 where uname="dummy"&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;As you can see &lt;EM&gt;timestamp key=value key=value key=value ...&lt;/EM&gt; in this example is not good and &lt;STRONG&gt;,&lt;/STRONG&gt; or &lt;STRONG&gt;:&lt;/STRONG&gt; is not good delimiters because all of this delimiters can be in sql commands which cause broken extract fields.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2011 20:01:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12513#M1034</guid>
      <dc:creator>pero1234</dc:creator>
      <dc:date>2011-10-24T20:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best custom log event format for Splunk to eat?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12514#M1035</link>
      <description>&lt;P&gt;There are several ways to deal with the &lt;STRONG&gt;Sql_Text=Select * from Table1 where uname="dummy"&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;One way which will work if the Sql_Text=something is at the end of a log event is to use filed extractions (i.e. EXTRACT) in the props.conf file:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;EXTRACT-Sql_Text = Sql_Text=(?&lt;SQL_TEXT&gt;.+)$&lt;/SQL_TEXT&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;You could even do this directly in the search app without using the props.conf stuff. The following should give you a list with the count of the 10 most used Sql_Text expression grouped by the ClientIP field:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;* | rex field=_raw " Sql_Text=(?&amp;lt;SqlText&amp;gt;.+)$" |  stats count ClientIP, SqlText | sort 10 -count&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:00:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12514#M1035</guid>
      <dc:creator>RubenOlsen</dc:creator>
      <dc:date>2020-09-28T10:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best custom log event format for Splunk to eat?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12515#M1036</link>
      <description>&lt;P&gt;I use:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;key="value" || key="value" || key="value"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;My props.conf looks like this:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;[my_sourcetype]&lt;BR /&gt;
KV_MODE = none&lt;BR /&gt;
REPORT-event = my_sourcetype_event&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;My transforms.conf looks like this:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;[my_sourcetype_event]&lt;BR /&gt;
MV_ADD = true&lt;BR /&gt;
KEEP_EMPTY_VALS = true&lt;BR /&gt;
REGEX = ([^=(\s+\|\|\s+)]*?)\s*\=\s*(.)((?:[^\2]|[^=])*?)\2+?(?:\s+\|\|\s+|$)&lt;BR /&gt;
FORMAT = $1::$3&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;My events look like this:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;timestamp="2012-02-24 17:39:19 -0800 (PST)" || type="php" || message="my message" || variables_type="Warning" || variables_message="blah" || variables_function="sure" || variables_file="file.php" || variables_line="958" || severity="error" || user_uid="1212" || user_language="fr" || user_ctry_cd="AX" || user_name="nada" || user_init="124124" || user_is_employee="no" || request_uri="&lt;A href="http://foo.com/sure"&gt;http://foo.com/sure&lt;/A&gt;" || referer="&lt;A href="http://bar.com/foo"&gt;http://bar.com/foo&lt;/A&gt;" || ip="10.10.10.10" || message_id="6"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;The regex I made is pretty cool. It'll let you do:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;key=[any character]valuebla[any character]hvalue[any character] ||&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;dog="spot" ||&lt;BR /&gt;
alien='zonk' ||&lt;BR /&gt;
fruit=^apple^ ||&lt;BR /&gt;
broken=#not#brok#en# ||&lt;BR /&gt;
horriblekey="imnothorrible="yesyouare" ishouldbemyownfield="wellyouwont" i="give="up""" ||&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Sat, 25 Feb 2012 07:34:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12515#M1036</guid>
      <dc:creator>tcperkin</dc:creator>
      <dc:date>2012-02-25T07:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best custom log event format for Splunk to eat?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12516#M1037</link>
      <description>&lt;P&gt;Your transforms.conf worked amazing for me. All I had to do was format my source events like yours. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2015 18:57:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-custom-log-event-format-for-Splunk-to-eat/m-p/12516#M1037</guid>
      <dc:creator>joshualarkins</dc:creator>
      <dc:date>2015-05-07T18:57:09Z</dc:date>
    </item>
  </channel>
</rss>

