# Grok pattern error after upgrade logstash from 7.5.2 to 7.17.0v

**URL:** <https://discuss.elastic.co/t/grok-pattern-error-after-upgrade-logstash-from-7-5-2-to-7-17-0v/359986>\
**Category:** Logstash\
**Created:** [May 22, 2024, 11:17am UTC](https://discuss.elastic.co/t/grok-pattern-error-after-upgrade-logstash-from-7-5-2-to-7-17-0v/359986 "2024-05-22T11:17:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![padmavathi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/padmavathi/32/134714_2.png) [@padmavathi](https://discuss.elastic.co/u/padmavathi)\
**Post date:** [May 22, 2024, 11:17am UTC](https://discuss.elastic.co/t/grok-pattern-error-after-upgrade-logstash-from-7-5-2-to-7-17-0v/359986/1 "2024-05-22T11:17:01Z")

</div>

Hi ,

I have recently upgraded logstash version from 7.52 to 7.17.0.  
I am getting the grok pattern error now .i dont have any issues with the v7.5.2.

[2024-05-22T12:13:51,017][INFO][logstash.outputs.elasticsearch][uat] Using a default mapping template {:es\_version=\>8, :ecs\_compatibility=\>:disabled}  
[2024-05-22T12:13:52,088][ERROR][logstash.javapipeline][uat] Pipeline error {:pipeline\_id=\>"uat", :exception=\>#\<Grok::PatternError: pattern %{MODSECAPACHEERROR} not defined\>, :backtrace=\>["C:/Elastic/logstash/vendor/bundle/jruby/2.5.0/gems/jls-grok-0.11.5/lib/grok-pure.rb:123:in `block in compile'", "org/jruby/RubyKernel.java:1442:in `loop'", "C:/Elastic/logstash/vendor/bundle/jruby/2.5.0/gems/jls-grok-0.11.5/lib/grok-pure.rb:93:in `compile'", "C:/Elastic/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-grok-4.4.1/lib/logstash/filters/grok.rb:282:in `block in register'", "org/jruby/RubyArray.java:1821:in `each'", "C:/Elastic/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-grok-4.4.1/lib/logstash/filters/grok.rb:276:in `block in register'", "org/jruby/RubyHash.java:1415:in `each'", "C:/Elastic/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-grok-4.4.1/lib/logstash/filters/grok.rb:271:in `register'", "org/logstash/config/ir/compiler/AbstractFilterDelegatorExt.java:75:in `register'", "C:/Elastic/logstash/logstash-core/lib/logstash/java_pipeline.rb:232:in `block in register\_plugins'", "org/jruby/RubyArray.java:1821:in `each'", "C:/Elastic/logstash/logstash-core/lib/logstash/java_pipeline.rb:231:in `register\_plugins'", "C:/Elastic/logstash/logstash-core/lib/logstash/java\_pipeline.rb:590:in `maybe_setup_out_plugins'", "C:/Elastic/logstash/logstash-core/lib/logstash/java_pipeline.rb:244:in `start\_workers'", "C:/Elastic/logstash/logstash-core/lib/logstash/java\_pipeline.rb:189:in `run'", "C:/Elastic/logstash/logstash-core/lib/logstash/java_pipeline.rb:141:in `block in start'"], "pipeline.sources"=\>["C:/Elastic/logstash/config/configs/access\_log.logstash.conf", "C:/Elastic/logstash/config/configs/ohs.logstash.conf"], :thread=\>"#\<Thread:0x184045f run\>"}  
[2024-05-22T12:13:52,088][INFO][logstash.javapipeline][uat] Pipeline terminated {"pipeline.id"=\>"uat"}  
[2024-05-22T12:13:52,104][ERROR][logstash.agent] Failed to execute action {:id=\>:uat, :action\_type=\>LogStash::ConvergeResult::FailedAction, :message=\>"Could not execute action: PipelineAction::Create, action\_result: false", :backtrace=\>nil}

My config:

if [apache\_module] =~ /mod\_security/ {  
mutate {  
add\_tag =\> ["mod\_security", "ajax\_request"]  
}  
grok {  
match =\> {  
"message" =\> [  
"%{MODSECAPACHEERROR}",  
# Mod Serurity  
"ModSecurity: %{WORD:security\_level}. Operator %{WORD} matched %{INT:maturity\_value} at %{NOTSPACE} [file %{QUOTEDSTRING}] [line %{QUOTEDSTRING}] [id %{QUOTEDSTRING}] [msg %{QUOTEDSTRING:msg\_value}] [hostname %{QUOTEDSTRING:hostname}] [uri %{QUOTEDSTRING:request}] [unique\_id %{QUOTEDSTRING:unique\_id}]",  
"ModSecurity: %{WORD:security\_level}. Operator %{WORD} matched %{INT:maturity\_value} at %{NOTSPACE} [file %{QUOTEDSTRING}] [line %{QUOTEDSTRING}] [id %{QUOTEDSTRING}] [rev %{QUOTEDSTRING}] [msg %{QUOTEDSTRING:msg\_value}] [severity %{QUOTEDSTRING:severity}] [ver %{QUOTEDSTRING:ver}] [maturity %{QUOTEDSTRING:maturity\_value}] [accuracy %{QUOTEDSTRING:accuracy\_value}] [tag %{GREEDYDATA:tag}",  
# Catch all  
"%{GREEDYDATA:message}"  
]  
}  
tag\_on\_failure =\>   
overwrite =\> "message"  
}

Could you please help me on this ?

Thanks.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 22, 2024, 11:47am UTC](https://discuss.elastic.co/t/grok-pattern-error-after-upgrade-logstash-from-7-5-2-to-7-17-0v/359986/2 "2024-05-22T11:47:17Z")

</div>

> [@padmavathi](#):
>
> MODSECAPACHEERROR

This does not seem to be defined for either the legacy or ecs-v1 [patterns](https://github.com/logstash-plugins/logstash-patterns-core/tree/main/patterns). It suggests it was added to your 7.5.2 install. [This](https://gist.github.com/louiszuckerman/1346387/588b8e21191ceab754dfc21d9ee9b419e2214a79#file-gistfile1-txt-L27) is an example of how you could define it.

---

<div class="post-metadata">

**Author:** ![padmavathi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/padmavathi/32/134714_2.png) [@padmavathi](https://discuss.elastic.co/u/padmavathi)\
**Post date:** [May 22, 2024, 1:19pm UTC](https://discuss.elastic.co/t/grok-pattern-error-after-upgrade-logstash-from-7-5-2-to-7-17-0v/359986/3 "2024-05-22T13:19:58Z")

</div>

Great ,It's working now .Thank you
