<?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: Creating usage reports from logfiles in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66124#M16416</link>
    <description>&lt;P&gt;I used Manager » Fields » Field extractions to add a new field&lt;/P&gt;

&lt;P&gt;Markus&lt;/P&gt;</description>
    <pubDate>Wed, 31 Aug 2011 21:59:37 GMT</pubDate>
    <dc:creator>huaraz</dc:creator>
    <dc:date>2011-08-31T21:59:37Z</dc:date>
    <item>
      <title>Creating usage reports from logfiles</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66121#M16413</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am new to splunk and heard it can do nearly every type of reporting. I have an ADSL router creating logs in the following format:&lt;/P&gt;

&lt;P&gt;Aug 25 23:00:22 Vigor: Local User: 192.168.1.8:50829 -&amp;gt; 212.58.244.67:80 (TCP)Web&lt;/P&gt;

&lt;P&gt;How can I create a pie chart showing for each source (e.g. 192.168.1.8) to which destinations (e.g. 212.58.244.67) they went.&lt;/P&gt;

&lt;P&gt;I can import the logs and select the appropriate lines, but I don't know I can define variables (are these fields in splunk ?) for src and dst and plot them.&lt;/P&gt;

&lt;P&gt;Thank you&lt;BR /&gt;
Markus&lt;/P&gt;

&lt;P&gt;I read a bit about custom fields. I see without any search regex the follwoing events&lt;BR /&gt;
Aug 25 23:00:22 Vigor: Local User: 192.168.1.8:50829 -&amp;gt; 212.58.244.67:80 (TCP)Web host=ip-10-17-23-243 Options| sourcetype=router-kiwi Options| source=/home/markus/data/router-kiwi-2011-08-25.txt Options &lt;/P&gt;

&lt;P&gt;I created the following field extractions for host ip-10-17-23-243 (as it forces me to use either host, source or sourcetype)&lt;/P&gt;

&lt;P&gt;"User:\s*(?&amp;lt;mysrc&amp;gt;:.*) &lt;BR /&gt;
and &lt;BR /&gt;
-&amp;gt;\s*(?&amp;lt;mydst&amp;gt;:.*)"&lt;/P&gt;

&lt;P&gt;But when I create a search mysrc="192.168.1.8" I don't get anything. What do I do wrong ?&lt;BR /&gt;
How can I check the fields are correct ? When I do a search with | rex field=_raw "User:\s*(?&amp;lt;mysrc&amp;gt;:.*) -&amp;gt;\s*(?&amp;lt;mydst&amp;gt;:.*)" I don't get an error, but I also don't know what is mysrc nor mysdst.&lt;/P&gt;

&lt;P&gt;Markus&lt;/P&gt;</description>
      <pubDate>Sat, 27 Aug 2011 13:18:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66121#M16413</guid>
      <dc:creator>huaraz</dc:creator>
      <dc:date>2011-08-27T13:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating usage reports from logfiles</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66122#M16414</link>
      <description>&lt;P&gt;How are you creating the fields? As part of your search using the &lt;CODE&gt;rex&lt;/CODE&gt; operator, through the field extractor or directly through a configuration file such as &lt;CODE&gt;props.conf&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Sun, 28 Aug 2011 16:24:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66122#M16414</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-08-28T16:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating usage reports from logfiles</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66123#M16415</link>
      <description>&lt;P&gt;Hi Huaraz&lt;/P&gt;

&lt;P&gt;To extract the ips you can try to add this to your search:&lt;BR /&gt;
&lt;CODE&gt;| rex field=_raw "User:\s+(?&amp;lt;src&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*\s+-&amp;gt;\s+(?&amp;lt;dst&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Splunk doesn't tell you that the regex you apply to a search is not working the way you want, because it can only detect syntax errors.&lt;/P&gt;

&lt;P&gt;There are different ways to get the desired result: &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Check if the fields you just tried to create appear in the List if you click on "Pick fields" to the left of your search results (check the values that were found)&lt;/LI&gt;
&lt;LI&gt;Splunk can help you generate the regex if you select "Extract Fields" from the context menu of an event that contains the values you want to extract into fields/variables. You can then test and save field extractions&lt;/LI&gt;
&lt;LI&gt;You could also use 3rd party tool to help you with your regexes (&lt;A href="http://regex.larsolavtorvik.com/"&gt;http://regex.larsolavtorvik.com/&lt;/A&gt;)&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Once you have your fields you can append a reporting command to your search (then click on show report to format the report):&lt;/P&gt;

&lt;P&gt;Popular destinations(pie chart:&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;| chart count(src) by dst&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;Active Sources (pie chart):&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;| chart count(dst) by src&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Show when a source is active (line chart):&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;| timechart count(src) by src&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Or you could also just create a table of your sources and destination tuples:&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;| rex field=_raw "User:\s+(?&amp;lt;src&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*\s+-&amp;gt;\s+(?&amp;lt;dst&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" | where isnotnull(src) | table src dst | sort src&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2011 12:40:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66123#M16415</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2011-08-29T12:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating usage reports from logfiles</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66124#M16416</link>
      <description>&lt;P&gt;I used Manager » Fields » Field extractions to add a new field&lt;/P&gt;

&lt;P&gt;Markus&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2011 21:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66124#M16416</guid>
      <dc:creator>huaraz</dc:creator>
      <dc:date>2011-08-31T21:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating usage reports from logfiles</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66125#M16417</link>
      <description>&lt;P&gt;That worked&lt;BR /&gt;
Thank you&lt;BR /&gt;
Markus&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2011 22:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-usage-reports-from-logfiles/m-p/66125#M16417</guid>
      <dc:creator>huaraz</dc:creator>
      <dc:date>2011-08-31T22:46:01Z</dc:date>
    </item>
  </channel>
</rss>

