Chef ERB template with Logstash Grok pattern issues -


i have logstash config file need convert chef erb template (mainly filters section). however, keep running issues due format of grok patterns. below example of grok pattern.

  grok {     match => ["message", "<%{posint:seqnum1}>%{posint:seqnum2}: (\d*: |\.|\*)*%{syslogtimestamp:timestamp} %{word:tz}: \%%{word:facility_label}-(%{word:switch_id}-)*%{int:severity}-%{word:program}: %{greedydata:message}"] 

here issue. shortly after need have interpolation fill in ip address etc. wont because <% starts interpolation of own.

mutate {   add_field => {"[@metadata][sentry][msg]" => "%{host}"     "[@metadata][sentry][severity]" => "%{severity}"     "[@metadata][sentry][host]" => "<%= @sentry_host[:ipaddress] %>"     "[@metadata][sentry][pid]" => "<%= @sentry_pid %>"     "[@metadata][sentry][key]" => "<%= @sentry_key %>"     "[@metadata][sentry][secret]" => "<%= @sentry_secret %>"   } } 

so of values above processed string of <%= @sentry_... %>.

is there way around this? have tried escape method of <%%{posint:seqnum1}>%{posint:seqnum2}:%> seen here. still puts closing %> in. other ways escape characters/strings in erb?

thanks! josh

you don't want put %> in text. <%% becomes literal <% , doesn't need paired ending tag.

edit example of erb -x:

$ echo '<%% foo <%= asdf %> bar <%= baz %>' | erb -x #coding:ascii-8bit _erbout = ''; _erbout.concat "<% foo "; _erbout.concat(( asdf ).to_s); _erbout.concat " bar "; _erbout.concat(( baz ).to_s); _erbout.concat "\n" ; _erbout.force_encoding(__encoding__) 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -