<?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: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST) in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37832#M6954</link>
    <description>&lt;P&gt;The regex matches "POST" at the beginning of the event up until two CRLF (newlines) are found. &lt;CODE&gt;\r\n\r\n&lt;/CODE&gt; is the termination of the header in the HTTP protocol.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Aug 2012 06:12:12 GMT</pubDate>
    <dc:creator>ziegfried</dc:creator>
    <dc:date>2012-08-17T06:12:12Z</dc:date>
    <item>
      <title>SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37820#M6942</link>
      <description>&lt;P&gt;Trying to strip the header info out of the event below, leaving only the JSON. I've tried "|extract reload=true" but neither that nor restarting Splunk seems to be working. Must be something with my syntax. This example is trying to remove the first 2 lines (for sake of simplicity in getting it to work)&lt;/P&gt;

&lt;P&gt;props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[akamai_post_json]
SEDCMD-httpheader = s/(?mg)^POST.*$\n|^User-Agent.*$\n|//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;POST / HTTP/1.1
User-Agent: curl/7.26.0
Host: localhost
Accept: */*
Content-Length: 2552
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------0b1c32056fc5
------------------------------0b1c32056fc5
Content-Disposition: form-data; name="fileupload"; filename="default_connector_schema_1.0.json"
Content-Type: application/octet-stream
{
  "apiType" : "String",
  "apiFormat" : "String",
  "apiVersion" : 0,
  "ID" : "String",
  "startTime" : "String",
  "eventType" : "String",
  "cpCode" : 0,
  "message" : {
    "protocol" : "0",
    "protoVersion" : 0,
    "clientIP" : "String",
    "reqPort" : 0,
    "reqHost" : "String",
    "reqMethod" : "String",
    "reqPath" : "String",
    "reqQuery" : "String",
    "reqContType" : "String",
    "reqContLen" : 0,
    "sslProtocol" : "String",
    "sslVersion" : 0,
    "respStatus" : 0,
    "respRedirURL" : "String",
    "respContType" : "String",
    "respContLen" : 0,
    "respBytesServed" : 0,
    "userAgent" : "String",
    "originHostname" : "String"
  },
  "httpHeaders" : {
    "reqHeader" : {
      "accEnc" : "String",
      "accLang" : "String",
      "auth" : "String",
      "cacheCtl" : "String",
      "connection" : "String",
      "contMD5" : "String",
      "cookie" : "String",
      "DNT" : "String",
      "ifMatch" : "String",
      "ifMod" : "String",
      "ifNoMatch" : "String",
      "pragma" : "String",
      "range" : "String",
      "referer" : "String",
      "TE" : "String",
      "upgrade" : "String",
      "via" : "String",
      "xFrwdFor" : "String",
      "xReqWith" : "String"
    },
    "respHeader" : {
      "cacheCtl" : "String",
      "connection" : "String",
      "contEnc" : "String",
      "contLang" : "String",
      "contLen" : "String",
      "contMD5" : "String",
      "contDisp" : "String",
      "contRange" : "String",
      "date" : "String",
      "eTag" : "String",
      "expires" : "String",
      "lastMod" : "String",
      "p3p" : "String",
      "pragma" : "String",
      "server" : "String",
      "setCookie" : "String",
      "trailer" : "String",
      "transEnc" : "String",
      "vary" : "String",
      "warning" : "String",
      "wwwAuth" : "String"
    }
  },
  "performance" : {
    "reqHeadSize" : 0,
    "reqBodySize" : 0,
    "respHeadSize" : 0,
    "respBodySize" : "String",
    "downloadTime" : "String",
    "originName" : "String",
    "originIP" : "String",
    "originInitIP" : "String",
    "originRetry" : 0,
    "lastMileRTT" : 0,
    "lastMileBW" : 0,
    "netOriginRTT" : 0,
    "cacheStatus" : "String",
    "lastByte" : true,
    "cliCountry" : "String",
    "edgeIP" : "String",
    "reqID" : "String"
  }
}
------------------------------0b1c32056fc5--
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Aug 2012 20:12:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37820#M6942</guid>
      <dc:creator>beaunewcomb</dc:creator>
      <dc:date>2012-08-16T20:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37821#M6943</link>
      <description>&lt;P&gt;Just guessing but could it be those "\n"s ? You have put sed to line-by-line -mode, so "$" is now end-of-line and I doubt if need that extra newline in your sed command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-httpheader = s/(?mg)^POST.*$|^User-Agent.*$//g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Aug 2012 20:44:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37821#M6943</guid>
      <dc:creator>kallu</dc:creator>
      <dc:date>2012-08-16T20:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37822#M6944</link>
      <description>&lt;P&gt;Also, &lt;CODE&gt;SEDCMD&lt;/CODE&gt; props entries only fire at index time, so they won't affect any previously indexed data.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 21:17:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37822#M6944</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2012-08-16T21:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37823#M6945</link>
      <description>&lt;P&gt;To strip the whole HTTP header, the following regex should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-stripheader = s/^(?ms)POST.+?(\r?\n){2}//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you have to restart splunkd, since that settings is affecting indexing behavior.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 21:23:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37823#M6945</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-08-16T21:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37824#M6946</link>
      <description>&lt;P&gt;Tried it and did nothing noticeable.  I'm running real-time searches so make sure I'm getting the latest data.&lt;/P&gt;

&lt;P&gt;I edit props.conf, restart splunk, and reload my real-time search page.&lt;/P&gt;

&lt;P&gt;I was able to get POST to change to TEST by simply doing this:&lt;BR /&gt;
SEDCMD-httpheader = s/(?gism)(POST)/TEST/g&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 21:34:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37824#M6946</guid>
      <dc:creator>beaunewcomb</dc:creator>
      <dc:date>2012-08-16T21:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37825#M6947</link>
      <description>&lt;P&gt;Thanks.  No luck. Doesn't seem to affect the event at all.&lt;/P&gt;

&lt;P&gt;As noted above, I'm editing the conf, restarting Splunk from the web interface, then logging in and reloading my real-time search.&lt;/P&gt;

&lt;P&gt;I know the props file is in the right spot because I can change POST to TEST with &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-httpheader = s/(?gism)(POST)/TEST/g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Aug 2012 21:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37825#M6947</guid>
      <dc:creator>beaunewcomb</dc:creator>
      <dc:date>2012-08-16T21:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37826#M6948</link>
      <description>&lt;P&gt;you didn't use both of them at the same time, did you?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 21:37:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37826#M6948</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-08-16T21:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37827#M6949</link>
      <description>&lt;P&gt;Nope. I'm commenting out lines that don't work with #&lt;/P&gt;

&lt;P&gt;only one line is active at once... freaking weird.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 21:48:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37827#M6949</guid>
      <dc:creator>beaunewcomb</dc:creator>
      <dc:date>2012-08-16T21:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37828#M6950</link>
      <description>&lt;P&gt;My last guess is to additionally adjust the line-merging settings (also props.conf):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE=false
LINE_BREAKER=------------------------------\w+--([\r\n]+)
SEDCMD-stripheader = s/(?ms)^POST.+?(\r?\n){2}//g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Aug 2012 21:57:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37828#M6950</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-08-16T21:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37829#M6951</link>
      <description>&lt;P&gt;Wow. Close!&lt;/P&gt;

&lt;P&gt;Now I just have to get rid of:&lt;BR /&gt;
  ------------------------------0a7d7d9180f4&lt;BR /&gt;
  Content-Disposition: form-data; name="fileupload"; filename="default_connector_schema_1.0.json"&lt;BR /&gt;
Content-Type: application/octet-stream&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:16:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37829#M6951</guid>
      <dc:creator>beaunewcomb</dc:creator>
      <dc:date>2020-09-28T12:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37830#M6952</link>
      <description>&lt;P&gt;and the line at the end....&lt;/P&gt;

&lt;P&gt;------------------------------0a7d7d9180f4&lt;/P&gt;

&lt;P&gt;At least its progress lol&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 22:17:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37830#M6952</guid>
      <dc:creator>beaunewcomb</dc:creator>
      <dc:date>2012-08-16T22:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37831#M6953</link>
      <description>&lt;P&gt;Maybe you could break down what this is doing and I can figure it out from there:&lt;/P&gt;

&lt;P&gt;SEDCMD-stripheader = s/^(?ms)POST.+?(\r?\n){2}//g&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 22:22:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37831#M6953</guid>
      <dc:creator>beaunewcomb</dc:creator>
      <dc:date>2012-08-16T22:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37832#M6954</link>
      <description>&lt;P&gt;The regex matches "POST" at the beginning of the event up until two CRLF (newlines) are found. &lt;CODE&gt;\r\n\r\n&lt;/CODE&gt; is the termination of the header in the HTTP protocol.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 06:12:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37832#M6954</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-08-17T06:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37833#M6955</link>
      <description>&lt;P&gt;So the rest of the event your're seeing is the actual (multipart encoded) HTTP body.&lt;/P&gt;

&lt;P&gt;I'd suggest to use another substitution in the SEDCMD to eliminate the multipart boundaries.&lt;/P&gt;

&lt;P&gt;eg.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-stripheader = s/^(?ms)POST.+?(r?n){2}//g s/-{30}\V+//g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Aug 2012 06:15:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37833#M6955</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-08-17T06:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37834#M6956</link>
      <description>&lt;P&gt;This worked. You rule.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 18:14:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37834#M6956</guid>
      <dc:creator>beaunewcomb</dc:creator>
      <dc:date>2012-08-17T18:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD to strip HTTP headers from raw TCP input (JSON submitted from HTTP POST)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37835#M6957</link>
      <description>&lt;P&gt;{"log":"{\"serviceName\":\"xxxxx\",\"ipAddress\":\"\",\"timestamp\":\"2019-02-08T16:06:02.766+0000\",\"traceId\":\"\",\"level\":\"INFO\",\"logger\":\"yyyyyyyApplication\",\"message\":\"Started yyyyyApplication in 23.332 seconds (JVM running for 24.707)\",\"stack\":\"\",\"timeTaken\":\"\"}\n","stream":"stdout","time":"2019-02-08T16:06:02.767236274Z"}&lt;/P&gt;

&lt;P&gt;What could be the sedcmd used for this? The problem with this one is the nested log isn't being recognized as a json. I believe the reason is because of \n in the log.&lt;/P&gt;

&lt;P&gt;Please correct me if I am wrong and help me on this.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 21:16:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-to-strip-HTTP-headers-from-raw-TCP-input-JSON-submitted/m-p/37835#M6957</guid>
      <dc:creator>chandrasekharko</dc:creator>
      <dc:date>2019-02-13T21:16:50Z</dc:date>
    </item>
  </channel>
</rss>

