<?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: How to create named fields with regular expression in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472504#M132965</link>
    <description>&lt;P&gt;Hi Marcin,&lt;BR /&gt;
if this answer solves your problem, please accept and/or upvote it&lt;/P&gt;

&lt;P&gt;Ciao and next time!&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2019 14:19:36 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2019-10-31T14:19:36Z</dc:date>
    <item>
      <title>How to create named fields with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472497#M132958</link>
      <description>&lt;P&gt;Hi Team &lt;/P&gt;

&lt;P&gt;I need to filter logs to catch switches port numbers. I use Splunk Cloud, my expression: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\beth\d*(?:-\d+)*(?:/\d+(?:\.\d+)?)?\b
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How to create named field?&lt;/P&gt;

&lt;P&gt;Many Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 07:56:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472497#M132958</guid>
      <dc:creator>dabroma5</dc:creator>
      <dc:date>2019-10-31T07:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create named fields with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472498#M132959</link>
      <description>&lt;P&gt;Hi  dabroma5,&lt;BR /&gt;
you can create a field using rex command ( &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/8.0.0/SearchReference/Rex"&gt;https://docs.splunk.com/Documentation/SplunkCloud/8.0.0/SearchReference/Rex&lt;/A&gt; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\beth\d*(?&amp;lt;field1&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I cannot be more precise without an example and the indication of what values you want to extract in fields.&lt;/P&gt;

&lt;P&gt;P.S.: to display regexes use the Code Sample button.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 11:56:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472498#M132959</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-31T11:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create named fields with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472499#M132960</link>
      <description>&lt;P&gt;I wasn't enough specific. Below is part of my log:&lt;/P&gt;

&lt;P&gt;{"info":{"seqno":0,"evtType":1,"oTime":null,"links":null,"id":"9b0ae9a9-e424-11e9-a309-fd988b74a8c5","origin":null,"relations":[],"details":"","severity":5,"time":1569918148265,"headId":"9b0ae9a9-e424-11e9-a309-fd988b74a8c5","sa":2},"desc":{"alertId":{"desc":"The network port is down","label":"Link down"},"pointId":[{"desc":"Type: openflow\nIP: a.b.c.d","label":"device_name [a.b.c.d]"},{"desc":"","label":""},{"desc":"Network Interfaces","label":""},{"desc":"","label":"eth-0-36"}]},"id":{"alertId":"16","component":1,"pointId":["a-b-c-d","dev","1","36"]}}&lt;/P&gt;

&lt;P&gt;Port notation can be different depends on the device:&lt;BR /&gt;
Eth1/1.2; Eth1/2.500; eth-0-19/4; eth-0-4; Eth1/4&lt;/P&gt;

&lt;P&gt;How to create named field to present information in a table.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 13:46:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472499#M132960</guid>
      <dc:creator>dabroma5</dc:creator>
      <dc:date>2019-10-31T13:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create named fields with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472500#M132961</link>
      <description>&lt;P&gt;Hi dabroma5,&lt;BR /&gt;
If all your ports are called Eth or eth, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "(?&amp;lt;port&amp;gt;(Eth|eth)[^\"]*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can test it at &lt;A href="https://regex101.com/r/nE5Zjt/1"&gt;https://regex101.com/r/nE5Zjt/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 13:47:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472500#M132961</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-31T13:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create named fields with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472501#M132962</link>
      <description>&lt;P&gt;Hi Giuseppe,&lt;/P&gt;

&lt;P&gt;Works partially, on below notification  I am receiving &lt;STRONG&gt;Ethernet Module&lt;/STRONG&gt; instead of  &lt;STRONG&gt;Eth1/18&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;{"info":{"seqno":0,"evtType":1,"oTime":null,"links":null,"id":"4a063431-fb65-11e9-a309-fd988b74a8c5","origin":null,"relations":[],"details":"","severity":5,"time":1572474806370,"headId":"4a063431-fb65-11e9-a309-fd988b74a8c5","sa":2},"desc":{"alertId":{"desc":"","label":"Link down"},"pointId":[{"desc":"Type: cisco\nIP: A.B.C.D","label":"device-name [A.B.C.D]"},{"desc":"","label":""},{"desc":"Ethernet Module","label":""},{"desc":"","label":"Eth1/18"}]},"id":{"alertId":"Link-down","component":1,"pointId":["A-B-C-D","dev","1","180000"]}}&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Marcin&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 13:56:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472501#M132962</guid>
      <dc:creator>dabroma5</dc:creator>
      <dc:date>2019-10-31T13:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create named fields with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472502#M132963</link>
      <description>&lt;P&gt;Hi dabroma5,&lt;BR /&gt;
Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\"label\":\"(?&amp;lt;port&amp;gt;(Eth|eth)[^\"]*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/nE5Zjt/2"&gt;https://regex101.com/r/nE5Zjt/2&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 13:59:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472502#M132963</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-31T13:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create named fields with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472503#M132964</link>
      <description>&lt;P&gt;Hi  Giuseppe,&lt;/P&gt;

&lt;P&gt;| rex "\"label\":\"(?(Eth|eth)[^\"]*)"     - works perfect&lt;/P&gt;

&lt;P&gt;thanks&lt;BR /&gt;
Marcin&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 14:04:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472503#M132964</guid>
      <dc:creator>dabroma5</dc:creator>
      <dc:date>2019-10-31T14:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create named fields with regular expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472504#M132965</link>
      <description>&lt;P&gt;Hi Marcin,&lt;BR /&gt;
if this answer solves your problem, please accept and/or upvote it&lt;/P&gt;

&lt;P&gt;Ciao and next time!&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 14:19:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-named-fields-with-regular-expression/m-p/472504#M132965</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-31T14:19:36Z</dc:date>
    </item>
  </channel>
</rss>

