[ 
https://issues.apache.org/jira/browse/EAGLE-789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15676789#comment-15676789
 ] 

ASF GitHub Bot commented on EAGLE-789:
--------------------------------------

Github user anyway1021 commented on a diff in the pull request:

    https://github.com/apache/incubator-eagle/pull/669#discussion_r88662451
  
    --- Diff: 
eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/publisher/AlertFilePublisherTest.java
 ---
    @@ -0,0 +1,44 @@
    +package org.apache.eagle.alert.engine.publisher;
    +
    +import org.apache.eagle.alert.engine.coordinator.Publishment;
    +import org.apache.eagle.alert.engine.model.AlertStreamEvent;
    +import org.apache.eagle.alert.engine.publisher.impl.AlertFilePublisher;
    +import org.junit.Test;
    +
    +import java.util.Arrays;
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +public class AlertFilePublisherTest {
    +    private static final String TEST_POLICY_ID = "testPolicy";
    +
    +    @Test
    +    public void testAlertFilePublisher() throws Exception {
    +        Map<String, Object> properties = new HashMap<>();
    +        properties.put(PublishConstants.ROTATE_EVERY_KB, 1);
    +        properties.put(PublishConstants.NUMBER_OF_FILES, 1);
    +
    +        String property = "java.io.tmpdir";
    +        String tempDir = System.getProperty(property);
    +        System.out.println("OS current temporary directory is " + tempDir);
    +
    +        properties.put(PublishConstants.FILE_NAME, 
tempDir+"eagle-alert.log");
    --- End diff --
    
    Seems we need a system property "file.separator" between tempDir and 
"eagle-alert.log". Please check it.


> Add a new publisher to write alerts into a local file
> -----------------------------------------------------
>
>                 Key: EAGLE-789
>                 URL: https://issues.apache.org/jira/browse/EAGLE-789
>             Project: Eagle
>          Issue Type: New Feature
>    Affects Versions: v0.5.0
>            Reporter: Zhao, Qingwen
>            Assignee: Zhao, Qingwen
>             Fix For: v0.5.0
>
>
> Add a new publisher to write alerts into a local file
> configuration:
> {
>    "fileName" : "/tmp/eagle-alert.log",
>    "rotate_every_kb": 1024,
>    "number_of_files": 1
> }
> Result sample:
> Nov 18, 2016 6:05:14 PM 
> org.apache.eagle.alert.engine.publisher.impl.AlertFilePublisher onAlert
> INFO: 2016-11-18 10:05:14 UTC alertId=058269d2-f301-4e66-b924-3ea8cf577fc5, 
> siteId=sandbox, policyId=test, alertData={securityZone=NA, 
> dst=/user/hdfs/.Trash/Current/tmp/test/subtest/private1479463504173, 
> sensitivityType=NA, src=/tmp/test/subtest/private, allowed=true, 
> host=10.249.66.185, cmd=rename, user=hdfs, timestamp=1479463504177}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to