Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

RE: Build Vertex AI chat APP on application log data

I am trying to build vertex AI chat APP whose datastore will be application logs which are imported through a logs router sink and then ask questions to it like below.

Here is the error/exception from the application. 

1. What regions are impacted?

2. What clusters impacted?

3. What projects impacted?

4. What features impacted?

5. Source of error/exception

6. Start and end time of error/exception.

Any help will be appreciated.

0 2 208
2 REPLIES 2

Hi @priyance,

Welcome to Google Cloud Community!

Building a Vertex AI chat app to analyze application logs is a fantastic idea. Here's how you can approach building this system:

1. Data Import and Preprocessing

  • Use a Logs Router Sink to export application logs to your datastore, e.g., BigQuery, Cloud Storage, or a NoSQL database like Firestore.

  • Ensure the logs are structured properly—fields like regions, clusters, projects, features, timestamps, and exceptions should be clearly defined for effective querying.

2. Datastore Design

  • Choose a datastore that supports quick querying. BigQuery is a great option for handling structured log data and performing SQL-based queries.

  • Consider indexing key fields (e.g., region, cluster, project) to optimize performance.

3. Natural Language Processing with Vertex AI

  • Deploy Vertex AI to fine-tune a custom model (or use a pre-trained model like GPT series). The model should understand natural language queries like "What regions are impacted?" and translate them into structured queries to the datastore.

4. Application Design

  • Build a service layer that accepts user queries, processes them (with the Vertex AI model), and converts them into appropriate SQL or NoSQL queries to fetch log data. Example Query Conversion:

    • User query: "What regions are impacted?

    • Converted query: SELECT DISTINCT region FROM logs WHERE error IS NOT NULL AND timestamp BETWEEN start_time AND end_time;

5. Interactive Chat Application

  • Use a framework like Flask, FastAPI, or to create a chatbot interface.

  • Integrate your Vertex AI model with the application via APIs, allowing users to interact with logs naturally.

6.  Testing and Optimization

  • Test the application for accuracy in query translation and performance in retrieving data.

  • Optimize the Vertex AI model and datastore queries based on user feedback.

Additional Considerations:

  • Time Filtering: Ensure timestamps are formatted uniformly (e.g., ISO 8601) to avoid inconsistencies when querying for "start and end times."

  • Error Identification: Analyze log patterns to identify exceptions and their sources automatically.

  • Security: Implement authentication and access control to ensure only authorized users can query sensitive logs.

To address your questions, Here's how you can structure your questions and how Vertex AI will likely handle them:

1. What regions are impacted?:  In Vertex AI will search the region field in your logs for entries with error or exception severity. It will aggregate the results to provide a list of impacted regions.

2. What clusters are impacted?: Similar to regions, Vertex AI will search the cluster field for error entries and provide a list of impacted clusters.

3. What projects impacted?:  In Vertex AI will search the project field for error entries and provide a list of impacted projects.

4. What features impacted?: Vertex AI will search the feature field for error entries and provide a list of impacted features.

5. Source of error/exception: Vertex AI will search the error_message or error_type fields to locate the cause of the error. It will provide the error messages or related log context.

6. Start and end time of error/exception: Vertex AI will use the timestamp field to filter logs based on the specified time range. It will then provide the earliest and latest timestamps of the errors within that range.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

Thanks for detailed solution. I am trying this approach and if we can successfully build it, will update this thread as well as accept this as solution