<?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 do I sort vulnerabilities by reltime? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292833#M88393</link>
    <description>&lt;P&gt;BTW, thanks for the karma points! In the future, if you want to give someone karma points without subtracting from your own pool, you can click to upvote an answer/comment. That way, your karma pool isn't reduced.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 21:55:39 GMT</pubDate>
    <dc:creator>elliotproebstel</dc:creator>
    <dc:date>2018-02-13T21:55:39Z</dc:date>
    <item>
      <title>How do I sort vulnerabilities by reltime?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292829#M88389</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;earliest=-100d index=nessus OR index=nessus_workstation severity_id!=0 severity_id!=1 
| dedup signature_id sortby _time 
| join signature_id 
    [ inputlookup nessusLookup.csv
    | fields signature_id assigned_person status notes]
| search assigned_person="ryan*" 
| reltime 
| join type=outer signature_id 
    [ search earliest=-4d index=nessus OR index=nessus_workstation severity_id!=0 severity_id!=1 
    | stats count(dest_mac) as TotalHosts by signature_id ] 
| sort -reltime -severity_id -TotalHosts 
| table signature signature_id severity_id assigned_person status notes reltime TotalHosts 
| rename signature as Signature signature_id as ID severity_id as Severity assigned_person as Owner status as Status notes as Notes reltime as "First Seen" TotalHosts as "Total Hosts"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem:&lt;BR /&gt;
So I am wanting to sort vulnerabilities by the oldest one first. When I go through reltime Splunk sorts the string realtime returns. So instead of 28 days being smaller than 1 month it is marked as bigger. I have been fighting with this for a little bit now and I just think I am only seeing trees instead of the forest. Anyone want to poke me and send me off down the right path?&lt;/P&gt;

&lt;P&gt;The query:&lt;BR /&gt;
The first two lines are to get the base data where I want it to be&lt;BR /&gt;
the first join adds my lookup table to the mix (I do not want them to be automatic lookups)&lt;BR /&gt;
Then we filter for Ryan&lt;BR /&gt;
Then we add reltime&lt;BR /&gt;
the second join is so we only see the hosts most recently affected instead of getting all hosts that have ever been affected&lt;BR /&gt;
then we sort&lt;BR /&gt;
then we make a table&lt;BR /&gt;
and we tidy up by renaming&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 18:58:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292829#M88389</guid>
      <dc:creator>LoganRhamy</dc:creator>
      <dc:date>2018-02-13T18:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort vulnerabilities by reltime?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292830#M88390</link>
      <description>&lt;P&gt;First - to address the goal of sorting vulnerabilities from oldest to newest. Replace your current &lt;CODE&gt;sort&lt;/CODE&gt; statement with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort 0 _time -severity_id -TotalHosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The field _time contains an epoch timestring, so you can sort by that to go from smallest (oldest) to largest (newest).&lt;/P&gt;

&lt;P&gt;You should also replace this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| join signature_id 
     [ inputlookup nessusLookup.csv
     | fields signature_id assigned_person status notes]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup signature_id nessusLookup.csv OUTPUT signature_id assigned_person status notes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is more efficient and less subject to silent errors.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 19:16:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292830#M88390</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-13T19:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort vulnerabilities by reltime?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292831#M88391</link>
      <description>&lt;P&gt;switched the lookup to &lt;CODE&gt;lookup nessusLookup.csv signature_id OUTPUT signature_id assigned_person status notes&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;works like a charm. I knew I was missing the forest from the trees, thank you&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 19:35:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292831#M88391</guid>
      <dc:creator>LoganRhamy</dc:creator>
      <dc:date>2018-02-13T19:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort vulnerabilities by reltime?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292832#M88392</link>
      <description>&lt;P&gt;Oh, yes. Good catch on the syntax for the lookup. And glad to help!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 19:37:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292832#M88392</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-13T19:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort vulnerabilities by reltime?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292833#M88393</link>
      <description>&lt;P&gt;BTW, thanks for the karma points! In the future, if you want to give someone karma points without subtracting from your own pool, you can click to upvote an answer/comment. That way, your karma pool isn't reduced.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 21:55:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-sort-vulnerabilities-by-reltime/m-p/292833#M88393</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-13T21:55:39Z</dc:date>
    </item>
  </channel>
</rss>

