Skip to content

[Bug] Timezone discrepancy when exporting CSV files from discovery and dashboard #56371

@psanz-estc

Description

@psanz-estc

Kibana version: 7.5

Describe the bug:
In Kibana (7.5), when exporting data from discovery into CSV, the timestamp field in the CSV file is aligned with the timestamp field shown in discovery (more in the thread)

image

But when I create a dashboard with the same saved search, and then export the CSV file from there, the timestamp in the CSV file is in UTC

image

Timezone in Kibana is set to Madrid

image (2)

Looking at the queries, and it seems the date range takes into consideration the timezone, but the time conversion scripted field is not passed:

  1. Export via “Copy POST URL”:
https://xxxxxx.us-central1.gcp.cloud.es.io:9243/api/reporting/generate/csv?jobParams=(conflictedTypesFields:!(),fields:!(%27@timestamp%27,_id,_index,_score,_type,agent,bytes,clientip,event.dataset,extension,geo.coordinates,geo.dest,geo.src,geo.srcdest,host,hour_of_day,index,ip,machine.os,machine.ram,memory,message,phpmemory,referer,request,response,tags,timestamp,url,utc_time),indexPatternId:%2790943e30-9a47-11e8-b64d-95841ca0b247%27,metaFields:!(_source,_id,_type,_index,_score),searchRequest:(body:(_source:(excludes:!()),docvalue_fields:!((field:%27@timestamp%27,format:date_time),(field:timestamp,format:date_time),(field:utc_time,format:date_time)),query:(bool:(filter:!((match_all:()),(range:(timestamp:(format:strict_date_optional_time,gte:%272020-01-30T09:53:28.177Z%27,lte:%272020-01-30T10:08:28.177Z%27)))),must:!(),must_not:!(),should:!())),script_fields:(hour_of_day:(script:(lang:painless,source:%27doc%5B!%27timestamp!%27%5D.value.withZoneSameInstant(ZoneId.of(!%27Europe%2FBerlin!%27)).getHour()%27))),sort:!((_score:(order:desc))),stored_fields:!(%27*%27),version:!t),index:kibana_sample_data_logs),title:MyTest,type:search)
  1. “Export CSV” in the dashboard:
https://xxxxxx.us-central1.gcp.cloud.es.io:9243/api/reporting/v1/generate/immediate/csv/saved-object/search:746e6680-4348-11ea-8a21-af2e91cbed41' --data-binary '{"timerange":{"min":"2020-01-30T10:55:00+01:00","max":"2020-01-30T11:10:00+01:00","timezone":"Europe/Madrid"},"state":{"sort":[{"_score":{"order":"desc"}}],"docvalue_fields":[{"field":"@timestamp","format":"date_time"},{"field":"timestamp","format":"date_time"},{"field":"utc_time","format":"date_time"}],"query":{"bool":{"must":[],"filter":[{"match_all":{}},{"match_all":{}},{"range":{"timestamp":{"format":"strict_date_optional_time","gte":"2020-01-30T09:55:00.703Z","lte":"2020-01-30T10:10:00.703Z"}}}],"should":[],"must_not":[]}}}}

Expected behavior:
Both CSV export files should be aligned with the timezone configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:Reporting:CSVReporting issues pertaining to CSV file exportbugFixes for quality problems that affect the customer experienceneeds-teamIssues missing a team label

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions