Getting Data In

Customize output csv file name base on field value?

phamxuantung
Communicator

Hello, I have query that produce a table like this:

Quantity Company
4 Company_A
63 Company_B
13 Company_C

 

The requirement that I have to send each company their own data with the attached csv with their name, for example "report_for_Company_A.csv" , "report_for_Company_B.csv".

Company A will receive their row of data with their attached file name.

I try to use

 

 

|<my search that produce the table>
|eval myCustomFileName = "Report_for_" + Company
|ouputcsv $myCustomFileName$.csv

 

 

It does have the field myCustomFileName correct but the file output was name $myCustomFileName$.csv.

How do I do it?

Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @phamxuantung,

I'm not sure that's possible to use a variable for outputcsv command, but, if the number of companies isn't so large, you could schedule a report for each one that prepare a csv and directly send it by eMail.

Ciao.

Giuseppe

0 Karma

phamxuantung
Communicator

I'm considering making an alert for each company, but we're having over 40 associates, so that will require a bit of work creating and management, so I try to find a work around for a small requirement such as filename.

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...