embulk-parser-apache-log 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d77195ff8c816230eea533a5c60c384ced5d4585
4
- data.tar.gz: 59d01cc0e3b78329d454eb2b053841bc9334d574
3
+ metadata.gz: 72fef5da469e9dea85e8a433f872dccb531e04c7
4
+ data.tar.gz: e12c5013eb3688e8e27a6d67f6949d042e2623c8
5
5
  SHA512:
6
- metadata.gz: 4d92ba10fbc5100dd57a6edb67d37dc2c05313770b6c774bd9b1e48de5bab17667b05f02db0c4c37002cf87d053e840c969b070a79811a6c567c26178ba997db
7
- data.tar.gz: b9b7b24e908af7913f0dfee7b43f4374a622a4b7dea2cc8c4fd9325ac648afb94a96fda24023749ffea30ff18d55470d7d9758e3835fb35a50162caa483b44ce
6
+ metadata.gz: f63c0461d2be7368e9bb6e3f3714100ec3b8541d0aa3e3186dbf2c5c6bc9d9a13d64b64c3f0bb84cd51e5e097a747701545cdfd56d0173c2f1b7df617211b9c2
7
+ data.tar.gz: 53e3c4f7859ab55ff5b13d3ea63a3db4deb5d2ce467356790012f38c2652927885c942ae97c43421de2c975e7d2755d2df27c5138a5e1903016d88a5d9feba36
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.1.2 (2019-10-31)
2
+ ------------------
3
+ * Introduce `stop_on_invalid_record` option. [@lafent]
4
+
1
5
  0.1.1 (2017-11-20)
2
6
  ------------------
3
7
  * Use traditional constructors of TimestampParser against Embulk core deprecation [@dmikurube]
data/README.md CHANGED
@@ -10,6 +10,7 @@ Embulk parser plugin for apache log (common, combined)
10
10
  ## Configuration
11
11
 
12
12
  - **format**: log format(common,combined) (string, default: combined)
13
+ - **stop_on_invalid_record**: ignore invalid log entries (true, false) (boolean, default: true)
13
14
 
14
15
  ## Example
15
16
 
@@ -19,6 +20,7 @@ in:
19
20
  parser:
20
21
  type: apache-log
21
22
  format: common
23
+ stop_on_invalid_record: true
22
24
  ```
23
25
 
24
26
  ```
@@ -1,6 +1,6 @@
1
1
  plugins {
2
2
  id "com.jfrog.bintray" version "1.1"
3
- id "com.github.jruby-gradle.base" version "0.1.5"
3
+ id "com.github.jruby-gradle.base" version "1.5.0"
4
4
  id "java"
5
5
  id "checkstyle"
6
6
  }
@@ -13,7 +13,7 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.1.1"
16
+ version = "0.1.2"
17
17
 
18
18
  sourceCompatibility = 1.7
19
19
 
@@ -50,14 +50,16 @@ task checkstyle(type: Checkstyle) {
50
50
  source = sourceSets.main.allJava + sourceSets.test.allJava
51
51
  }
52
52
  task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
53
- jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
54
- script "${project.name}.gemspec"
53
+ jrubyArgs "-S"
54
+ script "gem"
55
+ scriptArgs "build", "${project.name}.gemspec"
55
56
  doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
56
57
  }
57
58
 
58
59
  task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
59
- jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
60
- script "pkg/${project.name}-${project.version}.gem"
60
+ jrubyArgs "-S"
61
+ script "gem"
62
+ scriptArgs "push", "pkg/${project.name}-${project.version}.gem"
61
63
  }
62
64
 
63
65
  task "package"(dependsOn: ["gemspec", "classpath"]) << {
@@ -32,9 +32,13 @@ import java.util.regex.Pattern;
32
32
 
33
33
  import com.google.common.base.Throwables;
34
34
 
35
+ import org.slf4j.Logger;
36
+
35
37
  public class ApacheLogParserPlugin
36
38
  implements ParserPlugin
37
39
  {
40
+ private static final Logger logger = Exec.getLogger(ApacheLogParserPlugin.class);
41
+
38
42
  public enum LogFormat
39
43
  {
40
44
  combined("combined"),
@@ -58,6 +62,9 @@ public class ApacheLogParserPlugin
58
62
  @ConfigDefault("\"combined\"")
59
63
  public LogFormat getFormat();
60
64
 
65
+ @Config("stop_on_invalid_record")
66
+ @ConfigDefault("true")
67
+ Boolean getStopOnInvalidRecord();
61
68
  }
62
69
 
63
70
  @Override
@@ -123,7 +130,12 @@ public class ApacheLogParserPlugin
123
130
  accessLogEntryMatcher = accessLogPattern.matcher(line);
124
131
 
125
132
  if(!accessLogEntryMatcher.matches()){
126
- throw new RuntimeException("unmatched line" + line);
133
+ if (task.getStopOnInvalidRecord()) {
134
+ throw new RuntimeException("unmatched line" + line);
135
+ } else {
136
+ logger.info("unable to parse line: " + line);
137
+ continue;
138
+ }
127
139
  }
128
140
 
129
141
  pageBuilder.setString(0,accessLogEntryMatcher.group(1));
@@ -132,7 +144,12 @@ public class ApacheLogParserPlugin
132
144
  try {
133
145
  pageBuilder.setTimestamp(3,time_parser.parse(accessLogEntryMatcher.group(4)));
134
146
  } catch(TimestampParseException ex) {
135
- throw Throwables.propagate(ex);
147
+ if (task.getStopOnInvalidRecord()) {
148
+ throw Throwables.propagate(ex);
149
+ } else {
150
+ logger.info("unable to parse time from line: " + line);
151
+ continue;
152
+ }
136
153
  }
137
154
  pageBuilder.setString(4,accessLogEntryMatcher.group(5));
138
155
  pageBuilder.setString(5,accessLogEntryMatcher.group(6));
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-parser-apache-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki Sato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-20 00:00:00.000000000 Z
11
+ date: 2019-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ~>
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
18
  version: '1.0'
19
19
  name: bundler
@@ -21,13 +21,13 @@ dependencies:
21
21
  type: :development
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '10.0'
33
33
  name: rake
@@ -35,7 +35,7 @@ dependencies:
35
35
  type: :development
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  description: Parses Apache Log files read by other file input plugins.
@@ -45,11 +45,12 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
48
+ - ".gitignore"
49
49
  - CHANGES.md
50
50
  - LICENSE.txt
51
51
  - README.md
52
52
  - build.gradle
53
+ - classpath/embulk-parser-apache-log-0.1.2.jar
53
54
  - config/checkstyle/checkstyle.xml
54
55
  - config/checkstyle/default.xml
55
56
  - example/config.yml
@@ -62,7 +63,6 @@ files:
62
63
  - lib/embulk/parser/apache-log.rb
63
64
  - src/main/java/org/embulk/parser/ApacheLogParserPlugin.java
64
65
  - src/test/java/org/embulk/parser/TestApacheLogParserPlugin.java
65
- - classpath/embulk-parser-apache-log-0.1.1.jar
66
66
  homepage: https://github.com/hiroyuki-sato/embulk-parser-apache-log
67
67
  licenses:
68
68
  - MIT
@@ -73,17 +73,17 @@ require_paths:
73
73
  - lib
74
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project:
86
- rubygems_version: 2.1.9
86
+ rubygems_version: 2.6.8
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Apache Log parser plugin for Embulk