Skip to content

Commit 06415f0

Browse files
committed
Convert postfix timestamps in syslog format to logstash dates
1 parent adaed13 commit 06415f0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

50-filter-postfix.conf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,20 @@ filter {
305305
"postfix_requiretls", "requiretls", "true"
306306
]
307307
}
308+
309+
# Convert timestamp fields from string to date
310+
# NOTE: postfix timestamps don't contain a year value, which makes logstash assume the current year.
311+
# Beware when parsing historic log files!
312+
date {
313+
match => [
314+
"postfix_anvil_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss"
315+
]
316+
target => "postfix_anvil_timestamp"
317+
}
318+
date {
319+
match => [
320+
"postfix_scache_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss"
321+
]
322+
target => "postfix_scache_timestamp"
323+
}
308324
}

test_pipeline.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ EOF
4444

4545
cat 50-filter-postfix.conf >> "$PIPELINE"
4646

47+
echo Preparing output config
4748
cat >> "$PIPELINE" << EOF
4849
output {
4950
file {

0 commit comments

Comments
 (0)