<?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: Retrieve comments from savedsearches.conf via Splunk GUI in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377761#M6458</link>
    <description>&lt;P&gt;i did it with spath, i will share it in the question&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2019 09:36:09 GMT</pubDate>
    <dc:creator>ramgnisiv</dc:creator>
    <dc:date>2019-04-01T09:36:09Z</dc:date>
    <item>
      <title>Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377752#M6449</link>
      <description>&lt;P&gt;We are adding comments to each search in our apps savedsearches.conf to keep our technical documentation for all saved searches as in-line as possible.&lt;/P&gt;

&lt;P&gt;We are using Splunk native comment macro for adding comments in-line.&lt;/P&gt;

&lt;P&gt;Inside the 'comment' tag this is done using JSON format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`comment("{"type":"xxx","title":"yyy","id":"123","dataSource":"zzz","dataSourceTechName":"sss","dataSourceGuiName":"ttt","scheduleFrequency":"1d"}")`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;All saved searches are in the savedsearches.conf file inside the app folder.&lt;/P&gt;

&lt;P&gt;The question is: How can we extract the comments for all saved searches with a single search in Splunk GUI and table the data in the 'comment' tag?&lt;/P&gt;

&lt;P&gt;With this search, i can get the 'search' from the savedsearches.conf, but i only want the 'comment' part of the search that gives me the field that are in the JSON, like title, type, id etc and the corresponding values:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/saved/searches splunk_server=local | table title  search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to be able to split the comment field into separate fields that display the field name and the corresponding value.&lt;/P&gt;

&lt;P&gt;Edit:&lt;/P&gt;

&lt;P&gt;Final version with correct way of working is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/saved/searches splunk_server=local 
 | where search like "%`comment(%" 
 | rex field=search "\`comment\(\"(?&amp;lt;comment&amp;gt;.*)\)\`" 
 | fields  search comment
 | spath input=comment
 | fields  - search comment
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Apr 2019 06:02:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377752#M6449</guid>
      <dc:creator>ramgnisiv</dc:creator>
      <dc:date>2019-04-01T06:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377753#M6450</link>
      <description>&lt;P&gt;@ramgnisiv &lt;BR /&gt;
Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/saved/searches splunk_server=local 
| where search like "%`comment(%" 
| rex field=search "\`comment\(\"(?&amp;lt;comment&amp;gt;.*)\)\`" | table title search comment
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 06:20:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377753#M6450</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-04-01T06:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377754#M6451</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/saved/searches splunk_server=local | table title  search
| makemv tokenizer="\s*\|\s*([^\|]+)" search
| eval search = mvfilter(match(search, "\s*`comment"))
| rename search AS comments
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Apr 2019 06:26:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377754#M6451</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-04-01T06:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377755#M6452</link>
      <description>&lt;P&gt;I get the following error when i apply this search:&lt;/P&gt;

&lt;P&gt;Error in 'SearchParser': Missing a closing tick mark for macro expansion.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 06:48:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377755#M6452</guid>
      <dc:creator>ramgnisiv</dc:creator>
      <dc:date>2019-04-01T06:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377756#M6453</link>
      <description>&lt;P&gt;I get an empty comments field when i apply this search&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 06:49:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377756#M6453</guid>
      <dc:creator>ramgnisiv</dc:creator>
      <dc:date>2019-04-01T06:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377757#M6454</link>
      <description>&lt;P&gt;I made a slight adjustment.  Try it now.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 06:51:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377757#M6454</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-04-01T06:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377758#M6455</link>
      <description>&lt;P&gt;I still get empty comment fields for all saved searches with the adjustment you did.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 07:01:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377758#M6455</guid>
      <dc:creator>ramgnisiv</dc:creator>
      <dc:date>2019-04-01T07:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377759#M6456</link>
      <description>&lt;P&gt;@@ramgnisiv&lt;/P&gt;

&lt;P&gt;I have updated my answer.&lt;/P&gt;

&lt;P&gt;Can you try it?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 08:39:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377759#M6456</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-04-01T08:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377760#M6457</link>
      <description>&lt;P&gt;This works, now i need to split the comment field into separate fields, called type, title, id, dataSource, dataSourceTechName, dataSourceGuiName, scheduleFrequency&lt;/P&gt;

&lt;P&gt;These fields must display the values that correspond to the fields.&lt;/P&gt;

&lt;P&gt;Any thoughts on how to do that also?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 09:15:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377760#M6457</guid>
      <dc:creator>ramgnisiv</dc:creator>
      <dc:date>2019-04-01T09:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377761#M6458</link>
      <description>&lt;P&gt;i did it with spath, i will share it in the question&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 09:36:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377761#M6458</guid>
      <dc:creator>ramgnisiv</dc:creator>
      <dc:date>2019-04-01T09:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377762#M6459</link>
      <description>&lt;P&gt;The final version i needed is based on Kamlesh's answer with the addition of the spath command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /servicesNS/-/-/saved/searches splunk_server=local 
 | where search like "%`comment(%" 
 | rex field=search "\`comment\(\"(?&amp;lt;comment&amp;gt;.*)\)\`" 
 | fields  search comment
 | spath input=comment
 | fields  - search comment
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Apr 2019 09:37:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377762#M6459</guid>
      <dc:creator>ramgnisiv</dc:creator>
      <dc:date>2019-04-01T09:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve comments from savedsearches.conf via Splunk GUI</title>
      <link>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377763#M6460</link>
      <description>&lt;P&gt;@ramgnisiv &lt;/P&gt;

&lt;P&gt;Gald to help you&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Happy Splunking&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 11:50:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Retrieve-comments-from-savedsearches-conf-via-Splunk-GUI/m-p/377763#M6460</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-04-01T11:50:21Z</dc:date>
    </item>
  </channel>
</rss>

