Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use RFC3339 format for timestamps in SQL module #15847

Merged
merged 2 commits into from Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.next.asciidoc
Expand Up @@ -62,6 +62,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

*Metricbeat*

- Use RFC3339 format for timestamps collected using the SQL module. {pull}15847[15847]


*Packetbeat*

Expand Down
16 changes: 8 additions & 8 deletions x-pack/metricbeat/module/sql/query/_meta/data_postgres.json
Expand Up @@ -10,7 +10,7 @@
"period": 10000
},
"service": {
"address": "172.22.0.2:5432",
"address": "192.168.0.3:5432",
"type": "sql"
},
"sql": {
Expand All @@ -19,27 +19,27 @@
"numeric": {
"blk_read_time": 0,
"blk_write_time": 0,
"blks_hit": 1923,
"blks_read": 111,
"blks_hit": 948,
"blks_read": 96,
"conflicts": 0,
"datid": 12379,
"deadlocks": 0,
"numbackends": 1,
"temp_bytes": 0,
"temp_files": 0,
"tup_deleted": 0,
"tup_fetched": 1249,
"tup_fetched": 616,
"tup_inserted": 0,
"tup_returned": 1356,
"tup_returned": 717,
"tup_updated": 0,
"xact_commit": 18,
"xact_commit": 3,
"xact_rollback": 0
},
"string": {
"datname": "postgres",
"stats_reset": "2020-01-21 11:23:56.53"
"stats_reset": "2020-01-25T18:21:44.869405Z"
}
},
"query": "select * from pg_stat_database"
"query": "select * from pg_stat_database where datname='postgres'"
}
}
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/sql/query/query.go
Expand Up @@ -150,7 +150,7 @@ func getValue(pval *interface{}) string {
case []byte:
return string(v)
case time.Time:
return v.Format("2006-01-02 15:04:05.999")
return v.Format(time.RFC3339Nano)
default:
return fmt.Sprint(v)
}
Expand Down
Expand Up @@ -73,7 +73,7 @@ func TestPostgreSQL(t *testing.T) {

config = testFetchConfig{
Driver: "postgres",
Query: "select * from pg_stat_database",
Query: "select * from pg_stat_database where datname='postgres'",
Host: fmt.Sprintf("postgres://%s:%s@%s:%s/?sslmode=disable", user, password, host, port),
Assertion: assertFieldNotContains("service.address", ":"+password+"@"),
}
Expand Down