GitHub user mmiklavc opened a pull request:

    https://github.com/apache/incubator-metron/pull/256

    Metron 257 Enable pcap result pagination from the Pcap CLI

    This builds on efforts from 
[https://github.com/apache/incubator-metron/pull/217](https://github.com/apache/incubator-metron/pull/217)
    
    This closes 
[https://issues.apache.org/jira/browse/METRON-257](https://issues.apache.org/jira/browse/METRON-257)
    
    The purpose for this PR is to give the user the ability to specify how many 
records per file should be written by the PCAP CLI tool. For example, if 1,000 
records are returned by a PCAP query and the user specifies 200 records per 
file, then the user should expect 5 PCAP files to be written to the current 
working directory.
    
    **Testing**
    Get PCAP data into Metron: Install and setup pycapa - the instructions 
below reference/mirror those in 
[PR-93](https://github.com/apache/incubator-metron/pull/93#issue-151705836)
    
    1. Install the pycapa library & utility ```$ cd /opt/pycapa/pycapa && pip 
install -r requirements.txt && python setup.py install```
    2. (if using singlenode vagrant) Kill the enrichment and sensor topologies 
via for i in bro enrichment yaf snort;do storm kill $i;done
    3. Start the pcap topology via 
/usr/metron/0.2.0BETA/bin/start_pcap_topology.sh
    4. Start the pycapa packet capture producer on eth1 via /usr/bin/pycapa 
--producer --topic pcap -i eth1 -k node1:6667
    5. Watch the topology in the Storm UI and kill the packet capture utility 
from before, when the number of packets ingested is over 3k.
    6. Ensure that at at least 3 files exist on HDFS by running hadoop fs -ls 
/apps/metron/pcap
    7. Choose a file (denoted by $FILE) and dump a few of the contents using 
the pcap_inspector utility via /usr/metron/0.2.0BETA/bin/pcap_inspector.sh -i 
$FILE -n 5
    8. Choose one of the lines and note the protocol.
    9. Note that when you run the commands below, the resulting file will be 
placed in the execution directory where you kicked off the job from.
    
    ### Fixed filter
    
    1. Run a fixed filter query by executing the following command with the 
values noted above (match your start_time format to the date format provided - 
default is to use millis since epoch)
    2. `/usr/metron/0.2.0BETA/bin/pcap_query.sh fixed -st <start_time> -df 
"yyyyMMdd" -p <protocol_num> -rpf 500`
    3. Verify the MR job finishes successfully. Upon completion, you should see 
multiple files named with relatively current datestamps in your current 
directory, e.g. pcap-data-20160617160549737+0000.pcap
    4. Copy the files to your local machine and verify you can them it in 
Wireshark. I chose a middle file and the last file. The middle file should have 
500 records (per the records_per_file option), and the last one will likely 
have a number of records <= 500.
    
    ### Query filter
    
    1. Run a Stellar query filter query by executing a command similar to the 
following, with the values noted above (match your start_time format to the 
date format provided - default is to use millis since epoch)
    2. `/usr/metron/0.2.0BETA/bin/pcap_query.sh query -st "20160617" -df 
"yyyyMMdd" -query "protocol == '6'"  -rpf 500`
    3. Verify the MR job finishes successfully. Upon completion, you should see 
multiple files named with relatively current datestamps in your current 
directory, e.g. pcap-data-20160617160549737+0000.pcap
    4. Copy the files to your local machine and verify you can them it in 
Wireshark. I chose a middle file and the last file. The middle file should have 
500 records (per the records_per_file option), and the last one will likely 
have a number of records <= 500.
    
    **References:**
    - https://github.com/apache/incubator-metron/pull/217
    - https://github.com/apache/incubator-metron/pull/156
    - https://github.com/apache/incubator-metron/pull/93#issue-151705836
    - 
https://github.com/apache/incubator-metron/tree/master/metron-sensors/pycapa

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mmiklavc/incubator-metron METRON-257

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-metron/pull/256.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #256
    
----
commit a06fd0b918bfd4d363d58ffb5c5c2dba015e7c57
Author: Michael Miklavcic <[email protected]>
Date:   2016-09-15T01:54:50Z

    Refactor pcap cli tests. Fix num reducers

commit cc06349495315a6e1e7b393cd4871bf3e855bc3b
Author: Michael Miklavcic <[email protected]>
Date:   2016-09-16T04:43:43Z

    METRON-257 Enable pcap result pagination from the Pcap CLI

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to