Does somebody know how to parse single line from a file and parse it for different outputs? For example: input is a log file, outputs are elasticsearch indices with different templates. I need to parse every line and save it into the first index and some of lines which has a promo code (like ?promo=wteaewfsthser) I need to put to another index as well. I think it's possible to use two logstash instances (correct me if I'm wrong please). But I want to know is it possible to use single instance of logstash and one configuration file?
Thanks,
Igor
Sounds like you're looking for clone. Note that only the filters that are present after the clone{} will be run on the cloned event.
Related
So theres a file which i can fill with strings using fs.write(), however I want to basically edit that file, specifically add strings to the file at specific positions in between already existing strings. I've tried many things listed on nodejs documentation about fs but I was never getting my desired result. Please help.
fs.createWriteStream but I am not able to figure out the options part of start here.
I'm trying to parse a XML file in order to retrieve the data in a list.
I need to extract the TITRE_N, the AUTEURS_N and the RESUME_N. I know how to do it but my problem is that for some reference, I don't have any data for AUTEURS_N. there is no tag and the result as you can think it that all the data after are shift! Do you know how I can parse this doc and handle the fact that sometimes I'm missing one tag that I usefully use?
thx a lot!
Hi. I am trying Amazon MWS for the first time. I have referred to - https://docs.developer.amazonservices.com/en_UK/reports/Reports_Overview.html
I made a call as shown in the diagram on that page. I am using the scratchpad.
Called the Request Report with required fields. In this case ReportType -
"_GET_MERCHANT_LISTINGS_DATA_"
Then I called the GetReportRequestList with the "ReportRequestId"
returned from the previous call.
Finally I am calling the - "GetReport" with the "GeneratedReportId"
which I got from the call previous to this and I get the response as
the above image.
I have no idea how to parse and use it. Can't make any sense about the format returned in the final call (Shown in the image).
If anyone worked with this API. Please point me to the right direction.
Thanks in advance
Depending on the ReportType, you'll either get a XML file or a CSV file back. The ReportType enumeration page in the docs will tell you which is which. While the XML format is somewhat well documented here, the CSV files are not, but most should be self-explanatory. _GET_MERCHANT_LISTINGS_DATA_ returns such a CSV file. You may be confused by the fact that one of its fields contains some HTML.
Since you don't state which programming language you intend to use: You can open a CSV file in Excel (or LibreOffice). Please note that unlike most CSV files, these are separated by tabs, not by commas or semicolons. Also, to answer your initial question: yes, this is normal.
Is there any way for me to write to a file and have it simply add any new data instead of replacing the previous data?
Currently I'm using CasperJS to extract a list of items on a page and I'm using fs.write on Node to save it.
I'd like to make one large list and add to it everytime I run the script instead of having separate entries every time.
Alternatively, is there any way to combine multiple HTML files in Node?
You can use fs.appendFile instead of fs.write. From the docs:
Asynchronously append data to a file, creating the file if it does not yet exist.
I have been trying to figure out how to set Pentaho to write DIFFERENT files for each input of the job.
My transformation will soon be able to fetch .txt files from an FTP, a varying number of files, the way my transformation is right now, whatever the number of files it gets from the folder(FTP or local) it is generating one big XLS output, the information in the output side is all correct, it all matches the data i want to extract with precision, but for organizing those files, i need pentaho to create a single file, from a single input.
If files (//PentahoIn0001.txt, //PentahoIn0002.txt, //PentahoIn0003.txt) are processed i want (//PentahoOut0001.xls, //PentahoOut0002.xls, //PentahoOut0003.xls) to be created, and the way it is right now it's only creating a single file with data worth of all three inputs.
So far i have tried several ways with no result, even posts from here and outside containing several other aid Transformations and jobs to do it, and it simply doesn't.
Save the output filename in the row, and making sure the rows are sorted on the filename call Transformation Executor with a new transformation that should save the data. Make sure to enable Row grouping on the filename field, and also pass the filename as a Parameter to the new transformation.
In the child transformation start with Get rows from result and save the result to the file using the passed filename parameter.