metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwallen <...@git.apache.org>
Subject [GitHub] metron pull request #570: METRON-937 Pycapa Consume Messages from Begin, End...
Date Thu, 01 Jun 2017 14:00:03 GMT
GitHub user nickwallen reopened a pull request:

    https://github.com/apache/metron/pull/570

    METRON-937 Pycapa Consume Messages from Begin, End, or Stored Offsets

    ## Changes
    
    * I have altered Pycapa so that it can consume messages from either the beginning, end
or the previously stored offsets of a topic.  This can be done using the `-o` or `--kafka-offset`
flag that can be either `begin`, `end`, or `stored`.  This defaults to `end`.
    * Added additional information when using the `--pretty-print` flag.  It will now show
the partition and offset for a packet, both on the producer-side (sending packets to Kafka)
or the consumer-side (receiving packets from Kafka).
    
    ## Testing
    
    1. Install Pycapa.
    
    1. Launch a Kafka Broker on your localhost.  For example, using Kafka installed via Brew
on my Mac.
    
       ```
       export KAFKA_HOME=/usr/local/Cellar/kafka/0.10.1.1/
       export KAFKA_CONF=$KAFKA_HOME/libexec/config
       zookeeper-server-start $KAFKA_CONF/zookeeper.properties
       kafka-server-start $KAFKA_CONF/server.properties
       ```
    
    1. Produce some packets.  Assumes you're actively using `en0` and Kafka is at `localhost:9092`.
 Let it run until it completes and captures 50 packets.
    
        ```
         pycapa --producer \
            --interface en0 \
            --kafka-broker localhost:9092 \
            --kafka-topic pcap \
            --max-packets 50
        ```
    
    1. Run the consumer. The consumer will not consume any packets.  It starts from the end
of the topic, by default, and since there are no active producers, there is nothing new to
consume.
    
        ```
        pycapa --consumer \
            --kafka-broker localhost:9092 \
            --kafka-topic pcap
            --pretty-print 1
        ```
    
    1. Run the consumer again, but start from the beginning of the topic.  You should be able
to consume all 50 packets.
    
        ```
        pycapa --consumer \
            --kafka-broker localhost:9092 \
            --kafka-topic pcap
            --pretty-print 1
            --kafka-offset begin
        ```
    
    
    ## Pull Request Checklist
    
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at
[Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).

    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are
trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically
master)?
    - [x] Have you included steps to reproduce the behavior or problem that is being changed
or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested
manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the
root incubating-metron folder via:
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way
that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?

    - [x] Have you verified the basic functionality of the build by building and running locally
with Vagrant full-dev environment or the equivalent?
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered
by building and verifying the site-book? If not then run the following commands and the verify
changes via `site-book/target/site/index.html`:
    


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

    $ git pull https://github.com/nickwallen/metron METRON-937

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

    https://github.com/apache/metron/pull/570.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 #570
    
----
commit 23af8e9535ee396ce1a722b51672d4e8a9a69b4d
Author: Nick Allen <nick@nickallen.org>
Date:   2017-05-05T21:51:05Z

    METRON-937 Pycapa Consume Messages from Begin, End, or Stored Offsets

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message