Grok patterns for credit card

Can someone suggest grok pattern for
4836-6646-5481
this is credit card number

Thanks
gaurav

A 12-digit credit card number? Haven't seen that anywhere.

\d{4}-\d{4}-\d{4}

it is regular expression, not a grok pattern .

%{GREEDYDATA:cardnumber} is the pattern which i found .

it is regular expression, not a grok pattern .

Grok patterns are made from regular expressions. There's no predefined pattern for this kind of credit card number but you can create one yourself using the regular expression I provided.

%{GREEDYDATA:cardnumber} is the pattern which i found .

Well, that pattern matches anything and everything, and greedily too, so it's a bad choice.

[2016-04-20 03:19:05] 123136 Declined 4365-0872-9310 1234 Master wallmart 411057 "No Remarks"

this is my data and can u help me to replace GREEDYDATA:cardNumber with your regular expression one

[%{TIMESTAMP_ISO8601:timestamp}] %{NUMBER:TxID} %{WORD:loglevel} %{GREEDYDATA:CardNumber} %{BASE10NUM:amount} %{WORD:method} %{WO
RD:Merchant} %{NUMBER:pinCode} "(%{GREEDYDATA:msg})"

Thanks

Either define a new grok pattern in a separate pattern file (the grok filter documentation covers this) or replace %{GREEDYDATA:CardNumber} with (?<CardNumber>\d{4}-\d{4}-\d{4}).

Wow !! Thanks It worked perfecty .

Can you give me some link where i can check this.cause i dont know why you have used ? and () here

Again, see the grok filter documentation.

https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html#_custom_patterns