<?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 format the output of a splunk query ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574079#M200064</link>
    <description>&lt;P&gt;I don't have a definitive way to extract url without the .git on the end.&amp;nbsp; I suggest using the rex command above to remove .git from url after it is extracted.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Nov 2021 20:53:36 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2021-11-08T20:53:36Z</dc:date>
    <item>
      <title>how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574049#M200048</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; I have a splunk query which results the two outputs (using table) such as "&lt;STRONG&gt;JOB_NAME&lt;/STRONG&gt;" and "&lt;STRONG&gt;JOB_ID&lt;/STRONG&gt;".&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;For example, the output values are '&lt;STRONG&gt;job_name&lt;/STRONG&gt;' is&amp;nbsp; '&lt;STRONG&gt;abcd&lt;/STRONG&gt;' and '&lt;STRONG&gt;job_id'&lt;/STRONG&gt; is '&lt;STRONG&gt;456&lt;/STRONG&gt;'.&amp;nbsp; The final output i would like to get is&amp;nbsp; "&lt;STRONG&gt;abcd-456&lt;/STRONG&gt;".&lt;/P&gt;&lt;P&gt;How can i update the splunk query to merge two outputs as one ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 16:39:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574049#M200048</guid>
      <dc:creator>rajs115</dc:creator>
      <dc:date>2021-11-08T16:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574051#M200049</link>
      <description>&lt;P&gt;Use an &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; with the concatenation operator to produce a new field.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval foo = job_name . "-" . job_id
| table foo&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 16:42:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574051#M200049</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-11-08T16:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574061#M200054</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp; The command you suggested is working as i need. I have another question. The&amp;nbsp;&lt;STRONG&gt;JOB_NAME &lt;/STRONG&gt;output&lt;STRONG&gt; is "abcd.exe". The output&lt;/STRONG&gt; i am getting after running the command you suggested is&lt;STRONG&gt; "abcd.exe-456". &lt;/STRONG&gt;Can you please suggest me how to &lt;STRONG&gt;delete '.exe' from the output?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 18:13:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574061#M200054</guid>
      <dc:creator>rajs115</dc:creator>
      <dc:date>2021-11-08T18:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574066#M200056</link>
      <description>&lt;P&gt;There are few ways to do that.&lt;/P&gt;&lt;P&gt;1) Strip .exe from JOB_NAME before concatenation.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval JOB_NAME=replace(JOB_NAME,".exe","")
| eval foo=JOB_NAME."-".JOB_ID&lt;/LI-CODE&gt;&lt;P&gt;2) Strip .exe from JOB_NAME during concatenation.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval foo=replace(JOB_NAME,".exe","")."-".JOB_ID&lt;/LI-CODE&gt;&lt;P&gt;3) Remove .exe from the concatenated string afterwards.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval foo=JOB_NAME."-".JOB_ID
| eval foo=replace(foo, ".exe", "")&lt;/LI-CODE&gt;&lt;P&gt;There are alternative methods for each of these.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 19:44:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574066#M200056</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-11-08T19:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574070#M200059</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Your answer is perfectly fine. I have a small problem running the query to replace an extension. To get this right, i am trying to extract a git url in my actual task. The git url looks like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;A href="https://git.mycompany.project.git" target="_blank"&gt;https://git.mycompany.project.git&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; here, i am trying to remove&lt;STRONG&gt; '.git'&lt;/STRONG&gt; from the end of the project url. I am running below command you suggested,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;to remove '.git' . But there is name '&lt;STRONG&gt;git&lt;/STRONG&gt;' at the beginning of the url as well.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval foo=replace(JOB_NAME,".git","")."-".JOB_ID&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final output is coming like this.&lt;/P&gt;&lt;P&gt;expected output:&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;A href="https://git.mycompany.project.git" target="_blank"&gt;https://git.mycompany.project&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Actual output:&amp;nbsp;&amp;nbsp;&lt;A href="https://git.mycompany.project.git" target="_blank"&gt;https:/.mycompany.project&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I just want to eliminate the &lt;STRONG&gt;.git &lt;/STRONG&gt;at the end of&amp;nbsp;the url. Not the first .&lt;STRONG&gt;git&lt;/STRONG&gt; from url. Can you please suggest me how to overcome this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 20:08:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574070#M200059</guid>
      <dc:creator>rajs115</dc:creator>
      <dc:date>2021-11-08T20:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574073#M200060</link>
      <description>&lt;P&gt;Try this alternative command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=foo mode=sed "s/\.git$//"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 08 Nov 2021 20:27:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574073#M200060</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-11-08T20:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574078#M200063</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; This is how i am extracting the JOB_NAME form the splunk logs&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Logs&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;proj_url\tst[0;x= &lt;A href="https://git.mycompany.project.git" target="_blank"&gt;https://git.mycompany.project.git&lt;/A&gt; plan\tst[0;x=XbzuPbsj&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Splunk query i am using here:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| rex "(?&amp;lt;url&amp;gt;https\S+)"&lt;/P&gt;&lt;P&gt;The output returns the value of&amp;nbsp;&lt;A href="https://git.mycompany.project.git" target="_blank"&gt;https://git.mycompany.project.git&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to eliminate &lt;STRONG&gt;.git &lt;/STRONG&gt;in this query and return just&amp;nbsp;&amp;nbsp;&lt;A href="https://git.mycompany.project.git" target="_blank"&gt;https://git.mycompany.project&lt;/A&gt; ?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 20:43:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574078#M200063</guid>
      <dc:creator>rajs115</dc:creator>
      <dc:date>2021-11-08T20:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574079#M200064</link>
      <description>&lt;P&gt;I don't have a definitive way to extract url without the .git on the end.&amp;nbsp; I suggest using the rex command above to remove .git from url after it is extracted.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 20:53:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574079#M200064</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-11-08T20:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574080#M200065</link>
      <description>&lt;P&gt;Now i understood how to run it properly. All working good now. Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 20:57:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574080#M200065</guid>
      <dc:creator>rajs115</dc:creator>
      <dc:date>2021-11-08T20:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574109#M200075</link>
      <description>&lt;P&gt;If your problem is resolved, then please click the "Accept as Solution" button to help future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 01:00:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574109#M200075</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-11-09T01:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to format the output of a splunk query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574111#M200076</link>
      <description>Hi rich, I already accepted your first comment as the solution to my question. Thanks.</description>
      <pubDate>Tue, 09 Nov 2021 01:02:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-format-the-output-of-a-splunk-query/m-p/574111#M200076</guid>
      <dc:creator>rajs115</dc:creator>
      <dc:date>2021-11-09T01:02:58Z</dc:date>
    </item>
  </channel>
</rss>

