<?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: Help with creating field extractions for map in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489144#M8187</link>
    <description>&lt;P&gt;hey thanks for the reply its working and i am poor at regex can you send Rex for remaining fields please?  &lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2019 18:47:32 GMT</pubDate>
    <dc:creator>vikram1583</dc:creator>
    <dc:date>2019-09-23T18:47:32Z</dc:date>
    <item>
      <title>Help with creating field extractions for map</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489142#M8185</link>
      <description>&lt;P&gt;Can you help map creating field extractions  Please use the ES CIM model where possible for field names: &lt;/P&gt;

&lt;P&gt;There are some variations in the log files so I included these two that we’re looking at:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-09-17 **:**:**.**** [Level: INFO][Server: **********][ServerIP: ::1][ThreadId: 141][RequesterIP:**.***.1.1][Verb:POST][RequestUri:https://***svcv3/authenticationgateway/profile/******/login][Headers:[Connection:Keep-Alive|Content-Length:118|Content-Type:application/json|Accept:*/*|Accept-Language:en-us |User-Agent:iOS **Bank (Version 2.18.0 Build 80329; 12.4.1; en-US; iPhone(iPhone11,2); |X-GDC-DeviceID:BA8BB0C7-2FF8-4C37-B17B-A5F01148D38E|X-GDC-Digest:l2RLaisPFvk6libgtBFQb85Sh17kM5moYGp6ipQ2Su0=|X-GDC-SessionToken:fe9bc5d5-259d-402b-aa35-861e0d260068|X-GDC-Method:2|X-GDC-Timestamp:2019-09-17T22:41:10.009|Originator:FlexClient|X-GDC-Version:1.001|X-GDC-ApplicationID:10043|X-GDC-MessageID:BABBFB13-F781-4FF6-B777-894BAF5CBD8A|RequestId:AEABFB13-F781-4FF6-B777-894BAF5CBD8A|X-Forwarded-For:108.**.233.***, 127.**.242.145, 10.126.**.250|X-Original-URL:/***/auth/**/profile/tokens/login| "AuthenticationLevel":"1","WebUserToken":"354643"}"][TimeTaken:][StatusCode:Created(201)]
2019-09-13 23:**:51.3120 [Level: INFO][Server: *****SVC04][ServerIP: ::1][ThreadId: 58][Response:{ ErrorCode = 10003, ErrorDescription = Unable to process the login request, "Code":30116267
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Below are the fields need to be extracted:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Accept-Language&lt;BR /&gt;
User-Agent&lt;BR /&gt;
X-GDC-DeviceID&lt;BR /&gt;
X-GDC-SessionToken&lt;BR /&gt;
X-GDC-Method&lt;BR /&gt;
X-GDC-ApplicationID&lt;BR /&gt;
X-Forwarded-For&lt;BR /&gt;
X-Original-URL&lt;BR /&gt;
AuthenticationLevel&lt;BR /&gt;
WebUserToken&lt;BR /&gt;
StatusCode&lt;BR /&gt;
ErrorCode&lt;BR /&gt;
ErrorDescription&lt;BR /&gt;
Code&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;For X-Forwarded-For, please only capture the first IP address.  &lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 17:44:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489142#M8185</guid>
      <dc:creator>vikram1583</dc:creator>
      <dc:date>2019-09-23T17:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating field extractions for map</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489143#M8186</link>
      <description>&lt;P&gt;Greetings @vikram1583,&lt;/P&gt;

&lt;P&gt;Here's a run-anywhere search to extract Accept-Language as AcceptLanguage. Try playing with that to get the rest of the fields. They're all nearly identical.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw = "2019-09-17 ::.** [Level: INFO][Server: **********][ServerIP: ::1][ThreadId: 141][RequesterIP:**.***.1.1][Verb:POST][RequestUri:https://***svcv3/authenticationgateway/profile/******/login][Headers:[Connection:Keep-Alive|Content-Length:118|Content-Type:application/json|Accept:*/*|Accept-Language:en-us |User-Agent:iOS **Bank (Version 2.18.0 Build 80329; 12.4.1; en-US; iPhone(iPhone11,2); |X-GDC-DeviceID:BA8BB0C7-2FF8-4C37-B17B-A5F01148D38E|X-GDC-Digest:l2RLaisPFvk6libgtBFQb85Sh17kM5moYGp6ipQ2Su0=|X-GDC-SessionToken:fe9bc5d5-259d-402b-aa35-861e0d260068|X-GDC-Method:2|X-GDC-Timestamp:2019-09-17T22:41:10.009|Originator:FlexClient|X-GDC-Version:1.001|X-GDC-ApplicationID:10043|X-GDC-MessageID:BABBFB13-F781-4FF6-B777-894BAF5CBD8A|RequestId:AEABFB13-F781-4FF6-B777-894BAF5CBD8A|X-Forwarded-For:108.**.233.***, 127.**.242.145, 10.126.**.250|X-Original-URL:/***/auth/**/profile/tokens/login| \"AuthenticationLevel\":\"1\",\"WebUserToken\":\"354643\"}\"][TimeTaken:][StatusCode:Created(201)]"
| append 
    [ | makeresults
      | eval _raw = "2019-09-13 23:**:51.3120 [Level: INFO][Server: *****SVC04][ServerIP: ::1][ThreadId: 58][Response:{ ErrorCode = 10003, ErrorDescription = Unable to process the login request, \"Code\":30116267" ]

| rex "Accept-Language:(?&amp;lt;AcceptLanguage&amp;gt;[^\|]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Sep 2019 18:32:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489143#M8186</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-23T18:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating field extractions for map</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489144#M8187</link>
      <description>&lt;P&gt;hey thanks for the reply its working and i am poor at regex can you send Rex for remaining fields please?  &lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 18:47:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489144#M8187</guid>
      <dc:creator>vikram1583</dc:creator>
      <dc:date>2019-09-23T18:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating field extractions for map</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489145#M8188</link>
      <description>&lt;P&gt;I'll help you out a little more.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;rex "Accept-Language:(?&amp;lt;AcceptLanguage&amp;gt;[^\|]+)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;See here for more info regarding the &lt;CODE&gt;rex&lt;/CODE&gt; command: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex&lt;/A&gt;. By default, we're performing &lt;CODE&gt;rex&lt;/CODE&gt; on the full &lt;CODE&gt;_raw&lt;/CODE&gt; value (the two lines in your question) which is what you want. From there, we have &lt;CODE&gt;"Accept-Language:(?&amp;lt;AcceptLanguage&amp;gt;[^\|]+)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The basic structure is &lt;CODE&gt;"(?&amp;lt;FieldName&amp;gt;[field extraction regex])"&lt;/CODE&gt;. In your case, the Accept-Language field always starts with &lt;CODE&gt;Accept-Language:&lt;/CODE&gt; which is why I put that &lt;EM&gt;before&lt;/EM&gt; the parend. &lt;CODE&gt;(?&lt;/CODE&gt; to signify that.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[^\|]+&lt;/CODE&gt; - This is the magic extraction. &lt;CODE&gt;[&lt;/CODE&gt; and &lt;CODE&gt;]&lt;/CODE&gt; defines multiple possible matches. Inside that, we have &lt;CODE&gt;^&lt;/CODE&gt; which just means NOT. After that, we have &lt;CODE&gt;\|&lt;/CODE&gt; which is just the &lt;CODE&gt;|&lt;/CODE&gt; character with the escape character &lt;CODE&gt;\&lt;/CODE&gt;. I did this because your &lt;CODE&gt;Accept-Language&lt;/CODE&gt; field ends with &lt;CODE&gt;|&lt;/CODE&gt; in your sample data.&lt;/P&gt;

&lt;P&gt;Add that all up, and we're grabbing everything between "Accept-Language:" and "|" in your sample data.&lt;/P&gt;

&lt;P&gt;See here for a nice introduction tutorial: &lt;A href="https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285"&gt;https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;See here for a fantastic online regex tester where you can practice using regular expressions (you can even use your data): &lt;A href="https://regex101.com"&gt;https://regex101.com&lt;/A&gt;. You can test your skills here: &lt;A href="https://regex101.com/quiz"&gt;https://regex101.com/quiz&lt;/A&gt;. &lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 20:31:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489145#M8188</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-23T20:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating field extractions for map</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489146#M8189</link>
      <description>&lt;P&gt;will the same Regex work for indexing operations?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 00:04:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489146#M8189</guid>
      <dc:creator>vikram1583</dc:creator>
      <dc:date>2019-09-24T00:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help with creating field extractions for map</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489147#M8190</link>
      <description>&lt;P&gt;I don't understand the question&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 05:08:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Help-with-creating-field-extractions-for-map/m-p/489147#M8190</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-24T05:08:45Z</dc:date>
    </item>
  </channel>
</rss>

